900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > centos下配置nginx服务器更改根目录

centos下配置nginx服务器更改根目录

时间:2021-03-05 05:09:40

相关推荐

centos下配置nginx服务器更改根目录

后端开发|php教程

nginx,index,location,FastCGI,html

后端开发-php教程

安装完nginx服务器后发现nginx的根目录在/usr/share/nginx/html/下,但是对于部署文件来说,在该目录下是不太习惯的,我就尝试着更改nginx访问的根目录

bluetooth spp 源码,vscode 查看编码,ubuntu安装的软件查看,用友nc tomcat,sqlite 远程代码执行,帝国cms 编辑器插件,web前端框架搭建 ui,java 高级爬虫框架,问卷 php,大标seo博客,装修网站html源码,网页图片自适应分辨率,仿微擎页面模板,页面关键词 提取,招聘管理系统 下载,ASP简单的系统程序lzw

# vi /etc/nginx/conf.d/default.conf

培训教育网站源码,ubuntu强制刷新dhcp,爬虫淘宝直播抽奖,php里载入其他php文件,seo sem定义lzw

## The default server#server {listen 80;server_name localhost;root /var/www; #修改新的目录为var下的www目录#charset koi8-r;#access_log logs/host.access.log main;location / {root /var/www;index index.html index.htm index.php index.phtml; #添加index.php和index.phtml# example#ModSecurityEnabled on;#ModSecurityConfig /etc/nginx/modsecurity.conf;}error_page 404 /404.html;location = /404.html {root /var/www; #修改新的目录文件}# redirect server error pages to the static page /50x.html#error_page 500 502 503 504 /50x.html;location = /50x.html {root /var/www; #修改新的目录文件}# 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 /var/www; #修改新的目录文件fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}# deny access to .htaccess files, if Apaches document root# concurs with nginxs one##location ~ /\.ht {# deny all;#}}

代理记账企业网站源码,vscode自动加注释,ubuntu 国内源,Target和tomcat,js操作服务端sqlite,爬虫爬取新闻类多级页面,php cms 手机,seo优化系统外推,php视频直播网站,asp 实现网页视频播放器程序代码,dede手机模板位置lzw

# :wq! #保存并退出

重启nginx服务器

# service nginx restart

即可修改成功!

以上就介绍了centos下配置nginx服务器更改根目录,包括了方面的内容,希望对PHP教学有兴趣的朋友有所帮助。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。