ubuntu上安裝nginx+mysql+php5-fpm(PHP5 - FastCGI Process Manager)

來源:互聯網
上載者:User

標籤:director   his   cto   nginx   nmp   rect   ice   cache   tar   

題外話:由於近段時間測試環境ssh鏈路品質不大好,經常短線。故我把整個安裝過程放到screen裡去執行,以防止斷線中斷了安裝過程。執行screen -S install,這樣斷線後,只要再執行screen -r install 就可以恢複之前的安裝介面。

1.安裝mysql

sudo apt-get install mysql-server mysql-client
安裝過程中要設定mysql root使用者的密碼。

2.安裝nginx

sudo apt-get install nginx

3.安裝成功後。我們重啟下nginx服務

sudo service nginx restart
啟動之後我們就可以訪問一下我們的地址了。看能不能出現nginx的歡迎介面。

4.安裝php5-fpm(PHP5 - FastCGI Process Manager)。

sudo apt-get install php5-fpm

5.接下來我們要修改一下nginx的網站配置了。

ngnix的設定檔存放在/etc/nginx/sites-available/default

server {
listen 80; ## listen for ipv4; this line is default and implied
listen [::]:80 default ipv6only=on; ## listen for ipv6
root /usr/share/nginx/www;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.html;
}
location /doc {
root /usr/share;
autoindex on;
allow 127.0.0.1;
deny all;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
try_files $uri =404;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
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;
}
}
增加了php解析的一些代碼在裡面。

6.我們在安裝php5相關的一些組件。

sudo apt-cache search php5
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
7.重啟服務

sudo service php5-fpm restart
sudo service nginx
8.寫個探針檔案試試吧。呵呵。

ubuntu上安裝nginx+mysql+php5-fpm(PHP5 - FastCGI Process Manager)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.