unbuntu 安装nginx

apt-get -y install nginx

service nginx start

浏览器输入localhost会显示欢迎界面

 修改配置文件使其支持PHP环境

cd /etc/nginx/sites-available
vi default
server {
        listen       80;
        server_name localhost;
        root /var/www/html;
        index index.php index.html;

        location / {
                try_files $uri $uri/ =404;
        }

        error_page 404 /404.html;
        error_page 500 502 503 504 /50x.html;

        location = /50x.html {
                root /var/www/html;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        }
}

 

posted @ 2017-10-19 17:04  呼尔查•恩和  阅读(176)  评论(0编辑  收藏  举报