nginx修改配置文件更改网站根目录无效?
CentOS6.4 64位,nginx是1.10.1,只需要显示html静态页面
原网站根目录是/usr/local/nginx/html
我需要改成/srv/www/,以下为nginx.conf文件内容
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
root /srv/www/;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /srv/www/;
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 /srv/www/;
# 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;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
保存、service nginx restart之后不生效,网站根目录还是nginx的欢迎页(/usr/local/nginx/html)
为什么?怎么办?
谢谢!
相关阅读:
scrapy 如何设置每个域名需要爬取的页面数目
关于initWithFrame
关于Java线程并发的一个小问题
PHP中魔术方法的作用是什么?
babel 为什么没能识别我 js 文件中的 jsx 语法?
图片与文字一起上传,类似发qq状态的效果,前台应该怎么给后台传数据?
Wordpress设置只允许登陆用户查看内容短码调用问题,求助
sae文档说已经内置了MySQLdb模块,为什么我调用其时它却不存在?
json导出表格问题
有人用过带有下拉刷新和侧滑删除的listview没有?或者recycleView,我昨天用了两个,效果不是很好
安装mod_php5模块, 实现apache对php的支持, 这个东西怎么理解??
scrapy多个spider怎么指定pipeline
私有资源下载链接 被盗取,是不是 只要过期时间内,都可以被别人下载?
编写完函数,继续往下编写准备,刚写一行就报错了
chrome F12功能是如何实现的?
在Mac上装Mysql启动不了
Android下安装apache、mysql、php环境
更新osx 10.11后,删除自带php版本,重新编译php 5.5.29,到make阶段提示错误。
哪一款linux发行版适合安装在10年前的笔记本上
iptables中的一个疑问