ubuntu 13.04 nginx php 安裝

來源:互聯網
上載者:User
之前一直摸索,百度好多文章,得出一個最簡單的安裝方法,但是不知道是否正確,或者有什麼遺漏的。

1.安裝nginx
sudo apt-get install nginx

2.安裝php
sudo apt-get install php5-fpm

3.配置nginx
sudo gedit /etc/nginx/sites-available/default

root /www;
index index.html index.htm index.php;

location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
}

4.啟動nginx
sudo service nginx start

安裝完畢,現在有兩個問題,網上的很多文章都差不多,主要的差異在PHP安裝和nginx配置哪裡。

1.php是否只需要安裝php5-fpm即可?

2. location ~ \.php$ {
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
# fastcgi_index index.php;
include fastcgi_params;
}
各行的配置分別代表什麼意思?

3.為什麼使用fastcgi_pass 127.0.0.1:9000;就無法啟動nginx?


回複討論(解決方案)

沒裝過,過來看看。

建議貼出代碼以供分析

首先,我建?你用centsos?作?php的服?器系?,他比ubuntu更?定,?一?你可以搜尋一下centos的?史即可?解.
sudo apt-get install nginx
sudo是?了提升?限 apt-get install是直接?ubuntu的?像取得安?包安?.
在centos裡的命令是 yum install nginx

在linux上搭建PHP?境非常麻?,不?我建?下?lnmp???合?境,用???合?境安?完?之後再??置nginx的?程?和fastcgi的一些高??定,?一部份非常麻?且重要,而且?有固定?置方法可供你?考,很多?西都要自己??摸索,因?每一台伺服器的硬體和效能不同,如果?置不好的?,你的?站?常常出???500或??502

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.