1、vim /usr/local/nginx/conf/nginx.conf 打开nginx配置文件
2、确保root 绝对路径下没有默认访问文件后缀文件
server {
listen 80;
server_name _;
access_log /data/wwwlogs/access_nginx.log combined;
root /data/wwwroot/default/;
autoindex on; //添加此行 目录列表展示
index index.html index.htm index.php;
#error_page 404 /404.html;
#error_page 502 /502.html;
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
3、/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 重启nginx
4、如果出现源码输出的情况,重启php
killall php-fpm 杀死进程
/usr/local/php/sbin/php-fpm 重启php