Ubuntu下是如何部署安裝 Nginx PHP MySQL的呢?上一篇我們介紹了關於Ubuntu下Apache PHP MySQL phpMyAdmin的快速部署安裝,接下來我們就來介紹一下Ubuntu下Nginx PHP MySQL的快速部署安裝,下面來看一看具體的步驟吧。
先更新軟體庫
sudo apt-get update
安裝MySQL
sudo apt-get install mysql-server
安裝Nginx
sudo apt-get install nginx
安裝php-fpm
sudo apt-get install php5-fpm
配置nginx 整合php
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/app sudo vi /etc/nginx/sites-available/app
編輯設定檔/etc/nginx/sites-available/app內容如下:
server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /path/to/laravel/public; index index.php index.html index.htm; server_name laravel.app; location / { try_files $uri $uri/ /index.php$query_string; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ { # With php5-fpm: try_files $uri =404; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /\.ht { deny all; } }
接下來在/etc/nginx/sites-enabled目錄下建立對應軟鏈接:
sudo ln -s /etc/nginx/sites-available/app /etc/nginx/sites-enabled/app
然後檢查設定檔正確性
sudo service nginx configtest
重新載入設定檔
sudo service nginx reload
安裝php 常用擴充功能
sudo apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-xcache
重啟php-fpm
sudo service php5-fpm restart
相關文章推薦:
Ubuntu下Apache PHP MySQL phpMyAdmin的快速部署安裝
lamp環境配置之CentOS 6.3下阿里雲端伺服器下LAMP 環境設定
laravel環境建置:laravel如何部署到阿里雲或騰訊雲端步驟
相關課程推薦:
以上是Ubuntu下Nginx + PHP + MySQL的快速安裝步驟的詳細內容。更多資訊請關注PHP中文網其他相關文章!