一、添加文件
/var/wwwroot/site1/index.html,内容保存为
<?php phpinfo();
二、找到nginx的配置文件,我的配置文件是 /etc/nginx/conf.d/default.conf
三、把default.conf内容修改为
server { listen 80; server_name www.test.com; location / { root /var/wwwroot/site1; index index.html index.htm index.php; } }
四、重启nginx
service nginx restart
五、打开浏览器,输入www.test.com,会看到输出phpinfo的信息