記得測試之前要關閉防火墻并禁止開機啟動?。。?!
站在用戶的角度思考問題,與客戶深入溝通,找到代縣網站設計與代縣網站推廣的解決方案,憑借多年的經驗,讓設計與互聯網技術結合,創造個性化、用戶體驗好的作品,建站類型包括:做網站、成都做網站、企業官網、英文網站、手機端網站、網站推廣、域名注冊、虛擬空間、企業郵箱。業務覆蓋代縣地區。
[root@centos6 local]# iptables -F
[root@centos6 local]# iptables-save
# Generated by iptables-save v1.4.7 on Fri Jan 13 00:27:50 2017
*filter
:INPUT ACCEPT [9:680]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [6:672]
COMMIT
# Completed on Fri Jan 13 00:27:50 2017
[root@centos6 local]# chkconfig iptables off
1.安裝好LNMP之后,使用瀏覽器訪問服務器IP可以看到Nginx的歡迎頁,證明安裝成功。

2.這個歡迎頁原文件在/nginx/html/目錄下,這個目錄下的文件可以直接被訪問。
[root@centos6 nginx]# cd html
[root@centos6 html]# ls
50x.html index.html
[root@centos6 html]# cat index.html |less
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h2>Welcome to nginx!</h2>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a >nginx.org</a>.<br/>
Commercial support is available at
……
3.要想解析php文件,需要編輯Nginx配置文件
[root@centos6 nginx]# vim /usr/local/nginx/conf/nginx.conf
4.去掉php配置前面的注釋符#,并更改網站根目錄
……
# 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$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
……
4.重新加載nginx配置文件:
[root@centos6 html]# nginx -s reload
5.在網站根目錄/usr/local/nginx/html/下添加一個info.php文件:
[root@centos6 html]# vim info.php
<?php
phpinfo();
?>
6.使用瀏覽器看到已經可以解析PHP

7.使用curl測試,默認訪問的是index.html
[root@centos6 html]# curl localhost
8.使用curl測試info.php
[root@centos6 html]# curl localhost/info.php
分享標題:LNMP搭建3:測試PHP解析
網頁鏈接:http://www.js-pz168.com/article2/gcjpoc.html
成都網站建設公司_創新互聯,為您提供網站排名、營銷型網站建設、網站導航、做網站、品牌網站制作、小程序開發
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯