ubuntu 安裝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 

第三節視頻:

sudo vim /etc/php/7.1/fpm/php.ini // 將cgi.fix_pathinfo=1這一行去掉注釋,將1改為0 sudo vim /etc/php/7.1/fpm/pool.d/www.conf // 配置這個 listen = /var/run/php7.1-fpm.sock sudo service php7.1-fpm restart sudo vim /etc/nginx/sites-available/default 

Nginx 基礎配置如下:

        listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /var/www/laravel-ubuntu/public; index index.php index.html index.htm; # Make site accessible from http://localhost/ server_name localhost; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ /index.php?$query_string; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules } location ~ \.php$ { try_files $uri /index.php =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php7.1-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } 

還有就是,注意 laravel-ubuntu 這個目錄的所有者為: www-data:www-data

最后給,storage 文件夾權限,重啟 Nginx


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM