美文网首页
nginx 安装,配置,命令

nginx 安装,配置,命令

作者: 55lover | 来源:发表于2017-11-20 19:03 被阅读0次

    1.下载 nginx

    http://nginx.org

    2.启动

    解压至c:\nginx,运行nginx.exe(即nginx -c conf\nginx.conf),默认使用80端口,日志见文件夹C:\nginx\logs

    或者 start nginx

    3.使用

    http://localhost

    4.关闭

    nginx -s quit

    nginx -s stop

    5. 常用配置

    Nginx.conf代码

    http {

    server {

    #1.侦听80端口

    listen 80;

    location / {

    # 2. 默认主页目录在nginx安装目录的html子目录。

    root html;

    index index.html index.htm;

    # 3. 没有索引页时,罗列文件和子目录

    autoindex on;

    autoindex_exact_size on;

    autoindex_localtime on;

    }

    # 4.指定虚拟目录

    location /tshirt {

    alias D:\programs\Apache2\htdocs\tshirt;

    index index.html index.htm;

    }

    }

    # 5.虚拟主机www.emb.info配置

    server {

    listen 80;

    server_name www.emb.info;

    access_log emb.info/logs/access.log;

    location / {

    index index.html;

    root emb.info/htdocs;

    }

    }

    }

    6.nginx常用命令

    nginx -s stop 强制关闭

    nginx -s quit 安全关闭

    nginx -s reload 改变配置文件的时候,重启nginx工作进程,来时配置文件生效

    nginx -s reopen 打开日志文件

    关注一波!喜欢一波!本人是前端菜鸟,正在做自己的个人博客邓鹏的博客, 使用的技术 vue + koa2 + mysql + php + nginx!

    相关文章

      网友评论

          本文标题:nginx 安装,配置,命令

          本文链接:https://www.haomeiwen.com/subject/tvcbvxtx.html