after installing the Nginx server found Nginx root directory under/usr/share/nginx/html/, but for the deployment of files, in this directory is not very accustomed to, I tried to change the root directory nginx access
# vi/etc/nginx/conf.d/default.conf
# # Thedefaultserver#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 and 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 theStaticPage/50x.html#error_page 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,ifApache ' s document root# concurs with Nginx ' s one# #location ~/\.ht {# Deny all;#}}
# : wq! #保存并退出
Restarting the Nginx server
# Service Nginx Restart
can be modified successfully!
The above describes the CentOS configuration Nginx server changes the root directory, including aspects of the content, I hope the PHP tutorial interested in a friend helpful.