内蒙古网站开发,企业怎么做app网址,网站分析内容,培训推广 seo去nginx.org下载nginx 以nginx-1.8.1为例解压到D盘nginx-1.8.1目录 假设NGINX_HOME为D:\nginx-1.8.1 3种启动途径#xff1a; 一、双击nginx.exe图标#xff0c;可见黑窗口一闪而过#xff0c;启动完毕。 二、命令行到nginx目录#xff0c;输入nginx启动。#xff08;注 一、双击nginx.exe图标可见黑窗口一闪而过启动完毕。 二、命令行到nginx目录输入nginx启动。注此方式命令行窗口无任何提示且被锁定 三、命令行到nginx目录输入start nginx启动此方式不锁定 命令汇总 nginx -s reload|reopen|stop|quit #重新加载配置|重启|停止|退出 nginx nginx -t #测试配置是否有语法错误 nginx [-?hvVtq] [-s signal] [-c filename] [-p prefix] [-g directives] -?,-h : 打开帮助信息 -v : 显示版本信息并退出 -V : 显示版本和配置选项信息然后退出 -t : 检测配置文件是否有语法错误然后退出 -q : 在检测配置文件期间屏蔽非错误信息 -s signal : 给一个 nginx 主进程发送信号stop停止, quit退出, reopen重启, reload重新加载配置文件 -p prefix : 设置前缀路径默认是/usr/local/Cellar/nginx/1.2.6/ -c filename : 设置配置文件默认是/usr/local/etc/nginx/nginx.conf -g directives : 设置配置文件外的全局指令 浏览地址http://localhost即可访问其默认页面即映射到NGINX_HOME/html/index.html 在NGINX_HOME下新建一个MySites文件夹 再新建两个Test和First文件夹 并加入index.html文件 打开NGINX_HOME/conf/nginx.conf 增加下面配置 server {listen 9000;server_name localhost;location / {root MySites/test;index index.html index.htm;}}server {listen 80;server_name first1.zns.com first2.zns.com;location / {root MySites/first;index index.html index.htm;}} 修改了配置文件 必须执行重新加载配置文件命令 nginx -s reload 修改hosts文件 增加映射 127.0.0.1 first1.zns.com 127.0.0.1 first2.zns.com 浏览器访问 http://localhost:9000/ http://first1.zns.com/ http://first2.zns.com/ 转载于:https://www.cnblogs.com/zengnansheng/p/10389270.html