nginx虚拟机的配置

一、添加文件

 /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的信息

猜你喜欢

转载自www.cnblogs.com/ivy-zheng/p/10989752.html