centos7安裝phpnginx
Ⅰ centos7 用yum方式安裝nginx並關聯php
沒必要,這么做,直接安裝一個寶塔,就全配置好了
Ⅱ 如何在阿里雲Centos7伺服器下安裝部署Nginx+PHP+Mysql+PHP擴展
1、典型的LNMP安裝問題
2、首先你得准備編譯環境
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers bison lynx
3、下載所需MySQL/nginx/php等安裝包
4、安裝nginx和mysql沒有先後順序
5、安裝php依賴包,安裝php,安裝php擴展及優化包
6、詳細的安裝步驟可以網上查LNMP安裝步驟
Ⅲ 為什麼centos7下nginx的php怎麼開啟報錯
首先要編輯php配置文件:
vi /etc/php.ini
error_reporting = E_ERROR
display_errors = On
因為我開啟了php-fpm。所以,還要編輯 php-fpm.conf文件,把php_flag[display_errors]設為on:
vi php-fpm.conf
php_flag[display_errors] = on
這樣在開發的時候就可以在瀏覽器中顯示php出現的錯誤了,非常方便。
Ⅳ 求大神指導Centos7 源碼編譯安裝Nginx+PHP 配置動靜分離
這個是我的服務的實際 將配置Nginx實現動靜分離,對php頁面的請求轉發給LAMP處理,而靜態頁面交給Nginx,以實現動靜分離。客戶請求靜態數據給Nginx,Nginx直接應答客戶端,當請求動態數據到Nginx時,Nginx讓客戶端去找LAMP,通過代理的方式,LAMP就和客戶端連接了。分別配置動態分離和靜態分離
(1)架設並調試後端LAMP架構,指定的域名,IP地址為xxxx,創建動態頁面test.php。
(2)配置Nginx(xxxx)處理動態頁面請求,並把域名改為 chaodiquan.com 在server{};段中加入以下代碼,檢測語法後,重啟Nginx
(3)客戶端輸入xxxx/test.php 成功後動態分離就實現了,接下來再配置靜態分離
(4)配置Nginx處理靜態頁面請求,在server{};中加入以下代碼,檢測語法後,重啟Nginx
location ~ .*.(gif|jpg|jpeg|bmp|swf)$ { #這段代碼意思是任意網址以這5種格式為結尾就到Nginx根目錄下的html文件夾尋找資源
root html;
expires 1d; #緩存一天}
(5)在nginx的html目錄中,放入圖片aa.jpg,然後在apache的動態測試頁test.php中添加
<html>
<body>
<img src="aaaa/aa.jpg">
</body>
</html>
(6)客戶端輸入xxxx/test.php測試,由於test.php是動態頁面,因此客戶端會找到LAMP架構中的Apache,然後調取圖片aa.jpg是靜態數據,所以從Nginx提取,最後反饋給客戶端。這個是
Ⅳ centos7怎麼安裝nginx
安裝環境為:最小化安裝的centos7,關閉seliunx。
最小化安裝centos:
關閉selinux
sed –i 『s/SELINUX=enforcing/SELINUX=disabled/g』 /etc/selinux/config
開始安裝nginx1.7.8
創建群組
groupadd www
創建一個用戶,不允許登陸和不創主目錄
useradd -s /sbin/nologin -g www -M www
#下載最新版nginx
wget -C
tar zxvf nginx-1.7.8.tar.gz
#編譯基本能運行的nginx
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_mole --with-http_ssl_mole --with-http_gzip_static_mole
make
make install
如果有錯誤提示:
./configure: error: C compiler cc is not found
解決方法:
yum install gcc gcc-c++
如果有錯誤提示:
./configure: error: the HTTP rewrite mole requires the PCRE library.
You can either disable the mole by using –without-http_rewrite_mole
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using –with-pcre=<path> option.
解決方法:
yum install pcre-devel
如果有錯誤提示:
./configure: error: SSL moles require the OpenSSL library.
Ⅵ 如何在 CentOS 7 中使用 Nginx 和 PHP7-FPM 安裝 Nextcloud
步驟 1 - 在 CentOS 7 中安裝 Nginx 和 PHP7-FPM
在開始安裝 Nginx 和 php7-fpm 之前,我們還學要先添加 EPEL 包的倉庫源。使用如下命令:
-------------------------------------
yum -y install epel-release
現在開始從 EPEL 倉庫來安裝 Nginx:
-------------------------------------
yum -y install nginx
然後我們還需要為 php7-fpm 添加另外一個倉庫。互聯網中有很個遠程倉庫提供了 PHP 7 系列包,我在這里使用的是 webtatic。
添加 PHP7-FPM webtatic 倉庫:
Ⅶ CentOS 7 用戶怎樣安裝 LNMP
配置安裝
基於 YUM 特性,可以簡單快速的安裝 LNMP 環境。
配置 YUM 源
CentOS 7 的 默認 YUM 源里的軟體包版本可能不是最新的,如果要安裝最新的軟體包就得配置下 YUM 源。
配置 YUM 源可以通過直接安裝 RPM (Red Hat Package Manager) 包,或者修改 Repository,本文講解通過安裝 RPM 方式。
首先需要安裝 EPEL ( Extra Packages for Enterprise Linux ) YUM 源,用以解決部分依賴包不存在的問題:
yum install -y epel-release
接著是 MySQL YUM 源,MySQL 官網給出了配置教程,因為本文章講解的是 CentOS 7,我們只需要安裝對應的 RPM 包就行了。
安裝 RPM 包前需要導入 RPM-GPG-KEY 文件,不然安裝過程會出錯。
將 MySQL RPM-GPG-KEY 另存為 mysql_pubkey.asc 並導入 :
rpm --import mysql_pubkey.asc
導入後安裝 CentOS 7 的 MySQL RPM 包:
rpm -Uvh http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
然後是 PHP YUM 源,PHP 最新的 RPM 包,可以使用 Remi's RPM repository。
導入 PHP RPM-GPG-KEY (remi):
rpm --import http://rpms.remirepo.net/RPM-GPG-KEY-remi
安裝 PHP RPM (remi) 包:
rpm -Uvh http://remi.mirrors.arminco.com/enterprise/remi-release-7.rpm
最後是 Nginx YUM 源,Nginx 官網也給出了配置教程。
導入 Nginx RPM-GPG-KEY:
rpm --import http://nginx.org/packages/keys/nginx_signing.key
安裝 Nginx RPM 包:
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
到目前為止,YUM 源已經安裝好了 ,接著進行下一步的配置。
MySQL YUM 源默認是啟用的 MySQL-5.6,PHP YUM 源默認都沒有啟用,Nginx YUM 源默認是啟用的 Nginx-1.8。
定位到 /etc/yum.repos.d/,對 後綴為 .repo 的文件進行編輯,修改 enabled 為 1 以啟用。
啟用 PHP-7.0 :
1、修改 /etc/yum.repos.d/remi.repo,將 [remi] 和 [remi-test] 下面的 enabled=0 改為 enabled=1;
2、修改 /etc/yum.repos.d/remi-php70.repo,將 [remi-php70] 下面的 enabled=0 改為 enabled=1;
sed -i "/remi\/mirror/{n;s/enabled=0/enabled=1/g}" /etc/yum.repos.d/remi.repo
sed -i "/test\/mirror/{n;n;s/enabled=0/enabled=1/g}" /etc/yum.repos.d/remi.repo
sed -i "/php70\/mirror/{n;s/enabled=0/enabled=1/g}" /etc/yum.repos.d/remi-php70.repo
到這一步 YUM 配置就算完成了,清除並生成 YUM 緩存使之生效:
yum clean all
yum makecache
安裝 MySQL + PHP + Nginx + phpMyAdmin
YUM 源已經配置好了,現在直接安裝 MySQL + PHP + Nginx + phpMyAdmin:
yum install -y mysql-community-server nginx php php-bcmath php-fpm php-gd php-json php-mbstring php-mcrypt php-mysqlnd php-opcache php-pdo php-pdo_dblib php-pgsql php-recode php-snmp php-soap php-xml php-pecl-zip phpMyAdmin
註:上面安裝的 php-* 可以根據實際使用情況選擇安裝
安裝完成後,進行下一步的環境配置,MySQL 配置文件在 /etc/my.cnf.d/,PHP 配置文件在 /etc/php-fpm.d/,Nginx 配置文件在 /etc/nginx/ ,phpMyAdmin 的配置文件在 /etc/phpMyAdmin/。
配置 MySQL
MySQL 配置文件保持默認,運行一次安全配置即可。
啟動 MySQL:
systemctl start mysqld.service
安全配置 MySQL:
設置 root 密碼、刪除匿名用戶、禁止 root 遠程登錄、刪除 test 資料庫、重新載入許可權表,一路 Y 下去
mysql_secure_installation
配置 PHP
PHP 默認配置文件使用的是監聽 9000 埠進行通信,針對小型單一、沒有做負債均衡的伺服器,可以使用 unix sock 方式通信。
使用 unix sock 方式需要修改 PHP 配置文件:
#更換監聽方式
listen = /dev/shm/php-fpm-default.sock
#監聽隊列最大長度為不限
listen.backlog = -1
#指定監聽用戶和用戶組(需存在)
listen.owner = www
listen.group = www
啟動 PHP-FPM:
systemctl start php-fpm.service
配置 Nginx
讓伺服器默認訪問顯示為 400 提示頁。
#新建名為 nginx-default.conf 的配置文件
touch /etc/nginx/conf.d/nginx-default.conf
#編輯配置文件
vi /etc/nginx/conf.d/nginx-default.conf
將以下信息輸入到 nginx-default.conf
server
{
listen 80 default;
return 400;
}
按下 Esc,輸入 :x 保存並退出。
防火牆放行 HTTP 埠訪問:
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --reload
啟動 Nginx:
systemctl start nginx.service
這時,在瀏覽器地址欄輸入當前伺服器 IP 就會看到一個 400 的提示頁面了。
進階!綁定域名+站點目錄+保存日誌+運行 PHP的配置文件:
server
{
listen 80; #監聽80埠
server_name default.com www.default.com; #綁定域名 default.com 和 www.default.com
index index.html index.htm index.php; #設置首頁文件,越前優先順序越高
charset utf-8; #設置網頁編碼
root /home/wwwroot/default; #設置站點根目錄
#運行 PHP
location ~ .*\.php$
{
fastcgi_pass 127.0.0.1:9000 #默認使用9000埠和PHP通信
#fastcgi_pass unix:/dev/shm/php-fpm-default.sock; #使用 unix sock 和PHP通信
fastcgi_index index.php;
fastcgi_param DOCUMENT_ROOT /home/wwwroot/default; #PHP 文檔根目錄
fastcgi_param SCRIPT_FILENAME /home/wwwroot/default$fastcgi_script_name; #PHP 腳本目錄
include fastcgi_params;
try_files $uri = 404;
}
#設置文件過期時間
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp3|wma)$
{
expires 30d;
}
#設置文件過期時間
location ~ .*\.(js|css)$
{
expires 12h;
}
#設置文件訪問許可權
location ~* /templates(/.*)\.(bak|html|htm|ini|old|php|tpl)$ {
allow 127.0.0.1;
deny all;
}
#設置文件訪問許可權
location ~* \.(ftpquota|htaccess|htpasswd|asp|aspx|jsp|asa|mdb)?$ {
deny all;
}
#保存日誌
access_log /var/log/nginx/default-access.log main;
error_log /var/log/nginx/default-error.log crit;
}
配置 phpMyAdmin
# 編輯配置文件
vi etc/phpMyAdmin/config.inc.php
修改以下內容:
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['socket'] = '/var/lib/mysql/mysql.sock';
$cfg['Servers'][$i]['connect_type'] = 'socket';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['UploadDir'] = '/tmp';
$cfg['SaveDir'] = '/tmp';
如果Nginx使用的是上面的進階代碼,那麼把 phpMyAdmin 的目錄 復制到 /home/wwwroot/default/phpMyAdmin/ 下面,就可通過 http://default.com/phpMyAdmin 訪問了:
#復制 phpMyAdmin 目錄
cp -a /usr/share/phpMyAdmin /home/wwwroot/default/
#替換連接形式為目錄
rm -rf /home/wwwroot/default/phpMyAdmin/doc/html
cp -a /usr/share/doc/phpMyAdmin-<span class="pl-k">*</span>/html /home/wwwroot/default/phpMyAdmin/doc/
一鍵腳本
上面已經講解了如何配置和安裝,但是不能每次都這么一步一步來吧?為了節省時間,麥蔥寫了一個一鍵安裝管理腳本,可選擇安裝 Nginx 1.8/1.9、 MySQL 5.5/5.6/5.7 和 PHP 5.5/5.6/7.0。
安裝
yum install -y unzip
wget https://github.com/maicong/LNMP/archive/master.zip
unzip master.zip
cd LNMP-master
bash lnmp.sh
# 輸出到指定文件
# bash lnmp.sh 2>&1 | tee lnmp.log
管理站點
service vhost (start,stop,list,add,edit,del,exit) <domain> <server_name> <index_name> <rewrite_file> <host_subdirectory>
start 啟動
stop 停止
list 列出
add 添加
edit 編輯
del 刪除
exit 什麼都不做
<domain>: 配置名稱,例如:domain
<server_name>: 域名列表,例如:domain.com,www.domain.com
<index_name>: 首頁文件,例如:index.html,index.htm,index.php
<rewrite_file>: 偽靜態規則文件,保存在 /etc/nginx/rewrite/ 例如:nomal.conf
<host_subdirectory>: 是否支持子目錄綁定,on 或者 off
示例:
#添加一個標識為 domain 的站點
service vhost add domain domain.com,www.domain.com index.html,index.htm,index.php nomal.conf on
#啟動標識為 domain 的站點
service vhost start domain
#停止標識為 domain 的站點
service vhost stop domain
#編輯標識為 domain 的站點
service vhost edit domain
#刪除標識為 domain 的站點
service vhost del domain
#列出所有站點
service vhost list
備份數據
service vbackup (start,list,del) <delete name.tar.gz>
start 添加
list 列出
del 刪除
示例:
#添加一個新的備份
service vbackup start
#列出備份文件
service vbackup list
#刪除一個備份
service vbackup del name.tar.gz
Ⅷ 如何在CentOS 7中使用Nginx和PHP7-FPM安裝Nextcloud
先決條件64 位的 CentOS 7伺服器的 Root 許可權,在 CentOS 7 中安裝 Nginx 和 PHP7-FPM,在開始安裝 Nginx 和 php7-fpm 之前,要先添加 EPEL 包的倉庫源。從 EPEL 倉庫來安裝 ,然後我們還需要為 php7-fpm 添加另外一個倉庫。互聯網中有很個遠程倉庫提供了 PHP 7 系列包,然後就是安裝 PHP7-FPM 以及 Nextcloud 需要的一些包。最後,從伺服器終端里查看 PHP 的版本號,以便驗證 PHP 是否正確安裝。詳細你可以去後盾人看看,這些都是後盾人裡面的,哪裡有詳細的視頻教學都是高質量,我自己就是在裡面學的。
Ⅸ linux怎麼快速安裝nginx和php,不用安裝資料庫
Linux下如果要搭建nginx和php環境,需要安裝三個軟體包:
nginx,php,php-fpm
比如說如果是centos的話:
yuminstallnginxphpphp-fpm
可能軟體包名有差別,這個查查就知道了。
然後配置nginx,修改nginx.conf,如果用sock就這樣寫,如果是埠就些埠:
location~.php${
fastcgi_passunix:/var/run/php-fpm/php-fpm.sock;
fastcgi_indexindex.php;
includefastcgi.conf;
}
然後啟動服務,以centos7為例:
systemctlstartnginx
systemctlstartphp-fpm
Ⅹ 阿里雲默認centos7上怎麼安裝php
首先更新系統軟體</str>
$ yum update
安裝nginx</str></str>
1.安裝nginx源
$ yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm2.安裝nginx
$ yum install nginx
3.啟動nginx
$ service nginx start
Redirecting to /bin/systemctl start nginx.service4.訪問http://你的ip/
如果成功安裝會出來nginx默認的歡迎界面
安裝MySQL5.7.*
</str>
1.安裝mysql源</str>
$ yum localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm2.安裝mysql
$ yum install mysql-community-server
確認一下mysql的版本,有時可能會提示mysql5.63.安裝mysql的開發包,以後會有用
$ yum install mysql-community-devel
4.啟動mysql
$ service mysqld start
Redirecting to /bin/systemctl start mysqld.service5.查看mysql啟動狀態
$ service mysqld status
出現pid
證明啟動成功
6.獲取mysql默認生成的密碼
$ grep 'temporary password' /var/log/mysqld.log2015-12-05T05:41:09.104758Z 1 [Note] A temporary password is generated for root@localhost: %G1Rgns!dD!v</str>
加粗的就是生成的密碼
7.換成自己的密碼
$ mysql -uroot -p
Enter password:輸入上面的密碼
成功輸入後進入一下步,這里你估計會輸入 好幾次才進去8. 更換密碼
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';這個密碼一定要足夠復雜,不然會不讓你改,提示密碼不合法;9.退出mysql;
mysql> quit;
10.用新密碼再登錄,試一下新密碼
$ mysql -uroot -p
Enter password:輸入你的新密碼
11.確認密碼正確後,退出mysql;
mysql> quit;
編譯安裝php7.0.0
</str>
</str>
1.下載php7源碼包</str>
$ cd /root & wget -O php7.tar.gz http://cn2.php.net/get/php-7.0.1.tar.gz/from/this/mirror2.解壓源碼包</str>
$ tar -xvf php7.tar.gz
3.</str>
$ cd php-7.0.1
4.安裝php依賴包</str>
</str>
$ yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel5.編譯配置,這一步我們會遇到很多configure error,我們一一解決,基本都是相關軟體開發包沒有安裝導致</str>
</str>
$ ./configure \
--prefix=/usr/local/php \
--with-config-file-path=/etc \
--enable-fpm \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-soap \
--with-libxml-dir \
--with-xmlrpc \
--with-openssl \
--with-mcrypt \
--with-mhash \
--with-pcre-regex \
--with-sqlite3 \
--with-zlib \
--enable-bcmath \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-cdb \
--enable-dom \
--enable-exif \
--enable-fileinfo \
--enable-filter \
--with-pcre-dir \
--enable-ftp \
--with-gd \
--with-openssl-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-freetype-dir \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-gettext \
--with-gmp \
--with-mhash \
--enable-json \
--enable-mbstring \
--enable-mbregex \
--enable-mbregex-backtrack \
--with-libmbfl \
--with-onig \
--enable-pdo \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-zlib-dir \
--with-pdo-sqlite \
--with-readline \
--enable-session \
--enable-shmop \
--enable-simplexml \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-libxml-dir \
--with-xsl \
--enable-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--enable-opcache
configure error:
1.configure: error: xml2-config not found. Please check your libxml2 installation.
解決:
$ yum install libxml2 libxml2-devel
2.configure: error: Cannot find OpenSSL's <evp.h>
解決:
$ yum install openssl openssl-devel
3.configure: error: Please reinstall the BZip2 distribution解決:
$ yum install bzip2 bzip2-devel
4.configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/解決:
$ yum install libcurl libcurl-devel
5.If configure fails try --with-webp-dir=<DIR> configure: error: jpeglib.h not found.
解決:
$ yum install libjpeg libjpeg-devel
6.If configure fails try --with-webp-dir=<DIR>
checking for jpeg_read_header in -ljpeg... yesconfigure: error: png.h not found.
解決:
$ yum install libpng libpng-devel
7.If configure fails try --with-webp-dir=<DIR>
checking for jpeg_read_header in -ljpeg... yeschecking for png_write_image in -lpng... yesIf configure fails try --with-xpm-dir=<DIR>
configure: error: freetype-config not found.
解決:
$ yum install freetype freetype-devel
8.configure: error: Unable to locate gmp.h解決:
$ yum install gmp gmp-devel
9.configure: error: mcrypt.h not found. Please reinstall libmcrypt.
解決:
$ yum install libmcrypt libmcrypt-devel
10.configure: error: Please reinstall readline - I cannot find readline.h解決:
$ yum install readline readline-devel
11.configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution解決:
$ yum install libxslt libxslt-devel
6.編譯與安裝
$ make && make install
這里要make好久,要耐心一下
7.添加 PHP 命令到環境變數
$ vim /etc/profile
在末尾加入
PATH=$PATH:/usr/local/php/bin
export PATH
要使改動立即生效執行
$ ./etc/profile
或
$ source /etc/profile
查看環境變數
$ echo $PATH
查看php版本
$ php -v
8.配置php-fpm
$ cp php.ini-proction /etc/php.ini
$ cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf$ cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf$ cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm$ chmod +x /etc/init.d/php-fpm
9.啟動php-fpm
$ /etc/init.d/php-fpm start
配置nginx虛擬機,綁定域名</str>
1.
</str>
$ vim /etc/nginx/conf.d/php7.thinkcmf.com.conf這里可以把php7.thinkcmf.com.conf改成自己的域名把下面的內容復制到php7.thinkcmf.com.conf里server{
listen 80;
server_name php7.thinkcmf.com;
root /var/www/html/php7.thinkcmf.com; # 該項要修改為你准備存放相關網頁的路徑location / {
index index.php index.html index.htm;
#如果請求既不是一個文件,也不是一個目錄,則執行一下重寫規則if (!-e $request_filename)
{
#地址作為將參數rewrite到index.php上。
rewrite ^/(.*)$ /index.php/$1;
#若是子目錄則使用下面這句,將subdir改成目錄名稱即可。
#rewrite ^/subdir/(.*)$ /subdir/index.php/$1;}
}
#proxy the php scripts to php-fpm
location ~ \.php {
include fastcgi_params;
##pathinfo支持start
#定義變數 $path_info ,用於存放pathinfo信息set $path_info "";
#定義變數 $real_script_name,用於存放真實地址set $real_script_name $fastcgi_script_name;#如果地址與引號內的正則表達式匹配
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {#將文件地址賦值給變數 $real_script_name
set $real_script_name $1;
#將文件地址後的參數賦值給變數 $path_info
set $path_info $2;
}
#配置fastcgi的一些參數
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;fastcgi_param SCRIPT_NAME $real_script_name;fastcgi_param PATH_INFO $path_info;
###pathinfo支持end
fastcgi_intercept_errors on;
fastcgi_pass 127.0.0.1:9000;
}
}
2.重啟nginx
$ service nginx reload
3.
$ vim /var/www/html/php7.thinkcmf.com/index.php</str>
把下面的代碼復制到這個文件 里
<?php
phpinfo();
4.查看訪問http://php7.thinkcmf.com