ubuntu nginx php7.1

sudo apt-get update 

sudo apt-get install -y language-pack-en-base

locale-gen en_US.UTF-8



sudo apt-get install software-properties-common 

sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php

sudo apt-get update 



sudo apt-get -y install php7.1

sudo apt-get -y install php7.1-mysql

sudo apt-get install php7.1-fpm


apt-get install php7.1-curl php7.1-xml php7.1-mcrypt php7.1-json php7.1-gd php7.1-mbstring



sudo apt-get -y install nginx


sudo apt-get -y install mysql-server-5.6


原文鏈接:https://www.cnblogs.com/php-linux/p/6016439.html


nginx 配置文件:


server {

       listen 80;

       listen [::]:80;


       server_name abc.cn;


       root /var/www/abc_cn;

       index index.html index.php;


location / {

         try_files $uri $uri/ /index.php?$query_string;



       }

        location ~ \.php$ {

            include snippets/fastcgi-php.conf;

            fastcgi_pass unix:/run/php/php7.1-fpm.sock;

        }

}


因爲複製之前的配置文件,使用的是fastcgi_pass unix:/run/php/php7.0-fpm.sock;,導致出現502錯誤,和訪問php文件直接下載了,把7.0換成7.1後,就解決了。


如果出現500錯誤,就是權限問題


chmod -R 777 .


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章