nginx php mysql 部署_Linux+Nginx+Mysql+Php运维部署
1.更新軟件庫sudo?apt-get?update
2.安裝mysqlsudo?apt-get?install?mysql-server
3.安裝nginxsudo?apt-get?install?nginx
4.安裝php-fpmsudo?apt-get?install?php5-fpm
5.配置nginx(注:其中app為項目名稱)sudo?cp?/etc/nginx/sites-available/default?/etc/nginx/sites-available/app
sudo?vi?/etc/nginx/sites-available/app
6.nginx詳細配置
server?{
listen?80?default_server;
listen?[::]:80?default_server?ipv6only=on;
root?/var/www/advanced/frontend/web;
index?index.php?index.html?index.htm;
server_name?www.yii-china.com;
location?/?{
try_files?$uri?$uri/?/index.php?$args;
}
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;
}
}
7.接下來在/etc/nginx/sites-enabled目錄下創建對應軟鏈接:sudo?ln?-s?/etc/nginx/sites-available/app?/etc/nginx/sites-enabled/app
8.然后檢查配置文件正確性sudo?service?nginx?configtest
9.重新加載配置文件sudo?service?nginx?reload
10.安裝 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
11.重啟 php-fpmsudo?service?php5-fpm?restart
注意:
如果之前nginx中配置監聽9000端口來處理PHP,那么要改成監聽UNIX的socket,否則無法正確打開PHP頁面。即將fastcgi_pass?127.0.0.1:9000;
改成fastcgi_pass?unix:/var/run/php5-fpm.sock;
文章來源:http://laravelacademy.org/post/3184.html
總結
以上是生活随笔為你收集整理的nginx php mysql 部署_Linux+Nginx+Mysql+Php运维部署的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 王者荣耀心意卡有什么用 《王者》在线观看
- 下一篇: 王者荣耀正式服无限火力在哪