赞
踩
选择遗留的稳定版本:
解压到任意位置
cmd 进入nginx文件夹 输入命令行:start nginx
打开浏览器,输入: http://localhost:80 出现以下页面即为启动成功
将项目放到nginx的html文件夹下
配置说明:
1、listen:端口号
2、server_name:虚拟ip地址
3、root:声明默认网站根目录位置 --项目的根目录
4、index:定义首页索引文件的名称 --index.html
5、try_files:$uri $uri/ /app/index.html; 这里的设置是通过内部重定向的方式,去匹配目录下的索引文件index.html
6、location:控制服务访问路径
7、proxy_pass:请求代理转发
server {
listen 8011;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
try_files $uri $uri/ /index.html;
#root html;
#index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
cmd 进入nginx文件夹 输入命令行:nginx -s reload
直接点击nginx目录下的nginx.exe 或者
start nginx
nginx -s stop
nginx -s reload
nginx -s reopen
nginx -t -c /xxx/xx/nginx.conf
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。