nginx文件服务器修改根目录,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)
为什么?怎么办?
谢谢!
nginx文件服务器修改根目录,nginx修改配置文件更改网站根目录无效?相关推荐
- Amh/Nginx更改网站根目录
2019独角兽企业重金招聘Python工程师标准>>> 网站根目录是由Nginx的配置文件指定的.更改Amh虚拟主机的网站根目录,需要手动修改/usr/local/nginx/con ...
- 修改web服务器的网站主目录,Tomcat中更改网站根目录和默认页的配置方法
1.tomcat原来的默认根目录是http://localhost:8080,如果想修改访问的根目录,可以这样: 找到tomcat的server.xml(在conf目录下),找到: . 代码如下: u ...
- php修改根目录,phpStudy如何修改端口或WWW目录(网站根目录)
方法1: phpStudy修改端口或WWW目录(网站根目录)非常简单: 点击『其他选项菜单』-『phpStudy设置』-『端口常规设置』. 打开Apache的配置文件httpd-conf文件:打开ph ...
- 宝塔nginx文件服务器,宝塔面板nginx编译webdav模块 – 建立webdav服务器
要想Nginx支持WebDAV,需要手动添加http_dav_module和nginx-dav-ext-module模块.http_dav_module模块是nginx默认的模块,但是也需要手动编译. ...
- 服务器端的根目录放置文件,放置在网站根目录下
放置在网站根目录下 内容精选 换一换 本章节介绍如何将下载的证书安装到Resin服务器上.安装好证书后,您的Web服务器将能支持SSL通信,从而保证您Web服务器的通信安全.如果证书安装过程中遇到问题 ...
- nginx文件服务器中文路径,nginx配置文件支持中文路径.htm
nginx配置文件支持中文路径 nginx配置文件支持中文路径 例子: server { color=#ff0000>charset utf-8; listen 8088; se ...
- wamp如何更改网站根目录DocumentRoot
2019独角兽企业重金招聘Python工程师标准>>> 想必很多人都使用wamp来开发php的web应用吧,同时某些情况下我们或许需要修改服务器的根目录来方便我们搭建和开发网站,接下 ...
- 怎样快速找到网站根目录
什么是根目录? 什么是根目录?根目录,或根文件夹,是顶层目录一个的文件系统.目录结构可以直观地表示为上下颠倒的"树",因此术语" root "代表顶层.所有其它 ...
- Xshell的使用;用Xshell修改服务器 Nginx配置文件-超详细(以修改上传文件大小上限为例)
好多服务器都用Nginx做代理,当客户端上传视频,压缩包等文件时,往往会有一个设置上传文件最大限制的设置,我们以更改上传文件最大限制为例,从登录开始进行配置文件的修改. 适合哪些入职不久的前端吧~~~ ...
最新文章
- activiti工作流连接mysql_Activiti工作流 安装myeclipse activiti设计插件并生成数据库表...
- 【TCP/IP】IP路由选择
- RequestMapping注解的作用
- 3617. 子矩形计数
- 把 mysql 整个加载进内存磁盘中_MySQL 缓冲池 是什么?
- 账户配置 三: Gmail
- 基于JAVA+SpringMVC+Mybatis+MYSQL的车库管理系统
- 怎样解决编程语言之间的差异性问题?
- eclipse项目build时,提示错误.
- 概率论:均值、标准差、方差、协方差、矩
- mysql内置函数大全
- UMLChina公众号文章精选(20220807更新精选)
- 垃圾收集器总结--CMS垃圾收集器
- 基于MATLAB平台实现红绿灯(交通灯)识别
- 海康服务器获取cms信息失败,织梦CMS文档读取频道信息失败,无法进行后续操作!...
- kaggle之识别谷歌街景图片中的字母
- EAUML日拱一卒-微信小程序实战:位置闹铃 (13)-使用类优化程序结构
- 波恩大学癫痫脑电和波士顿儿童医院脑电信号数据集下载
- 【专题学习】Contiguity(进行中)
- 视频教程-人工智能-数学基础视频课程-机器学习