一、操作步驟 (具體文檔請(qǐng)聯(lián)系本博主,首頁(yè)有博主郵箱)
創(chuàng)新互聯(lián)主要從事做網(wǎng)站、成都做網(wǎng)站、網(wǎng)頁(yè)設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)扎蘭屯,10多年網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專業(yè),歡迎來(lái)電咨詢建站服務(wù):18982081108
1.更新
2.安裝Nginx
3.安裝MySQL
# 連續(xù)輸入兩次相同的密碼
4.安裝PHP
5.配置PHP,修改php.ini文件
將cgi.fix_pathinfo=1 設(shè)置為 cgi.fix_pathinfo=0
啟動(dòng)php-fpmsudo
6.配置Nginx讓其使用php-fpm進(jìn)程
備份/etc/nginx/sites-available/default文件
7.修改default配置文件支持PHP
下邊是配置文件詳細(xì)信息
[...]
server {
listen 80;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
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 displaying a 404.
try_files $uri $uri/ /index.html;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
allow ::1;
deny all;
}
# Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
#location /RequestDenied {
# proxy_pass http://127.0.0.1:8080;
#}
#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/html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ .php$ {
try_files $uri =404;
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;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /.ht {
deny all;
}
}
[...]
取消同時(shí)偵聽 IPv4 和 IPv6 的80端口。
server_name _; 默認(rèn)主機(jī)名 (當(dāng)然你可以修改,例如修改為: www.example.com).
index主頁(yè)這一行我們加入 index.php。
PHP 重要配置配置 location ~ .php$ {} 這幾行我們需要啟動(dòng),反注釋掉。另外再添加一行:try_files $uri =404。
8.重新加載nginx
9.修改PHP配置文件
修改 #cgi.fix_pathinfo=1: 為 cgi.fix_pathinfo=0:
[...]
; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting
; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting
; of zero causes PHP to behave as before. Default is 1. You should fix your scripts
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
; http://php.net/cgi.fix-pathinfo
cgi.fix_pathinfo=0
[...]
10.重新加載 PHP-FPM:
11.現(xiàn)在創(chuàng)建一個(gè)探針文件保存在 /usr/share/nginx/html目錄下
vi /usr/share/nginx/html/index.php
搭建成功PHP版本為
PHP logo
PHP Version 5.5.9-1ubuntu4.21
網(wǎng)頁(yè)標(biāo)題:Ubuntu14.04搭建LNMP
分享網(wǎng)址:http://www.yahangbao.cn/article6/gjppig.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供電子商務(wù)、云服務(wù)器、品牌網(wǎng)站設(shè)計(jì)、響應(yīng)式網(wǎng)站、企業(yè)網(wǎng)站制作、網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)