新聞中心
本文操作環(huán)境:ubuntu 16.04系統(tǒng)、php7.1版、DELL G3電腦

創(chuàng)新互聯(lián)建站專業(yè)為企業(yè)提供廊坊網(wǎng)站建設(shè)、廊坊做網(wǎng)站、廊坊網(wǎng)站設(shè)計(jì)、廊坊網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)與制作、廊坊企業(yè)網(wǎng)站模板建站服務(wù),十余年廊坊做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。
php 9000端口沒(méi)有啟動(dòng)怎么辦?php-fpm啟動(dòng)以后,沒(méi)有出現(xiàn)9000端口?
最近在復(fù)現(xiàn)一個(gè)php擴(kuò)展的后門(mén),需要搭建Nginx+php環(huán)境,nginx我是用源碼裸裝的,不帶任何第三方模塊。
php-cli和php-fpm 則是通過(guò)ubuntu的標(biāo)準(zhǔn)apt-get命令安裝的。
隨后需要修改nginx的nginx.conf文件讓其支持php腳本解析。
經(jīng)查詢網(wǎng)上的配置有兩種,一種是
支持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;
}
另一種是使用sock文件
location ~ .php$ {
root /usr/share/nginx/html;
fastcgi_pass unix:/var/run/php-fpm/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
剛開(kāi)始使用第一種9000端口的方式進(jìn)行配置,php解析不了,后經(jīng)過(guò)查詢php-fpm日志,發(fā)現(xiàn)有sock
[17-Sep-2019 00:23:02] NOTICE: fpm is running, pid 5617 [17-Sep-2019 00:23:02] NOTICE: ready to handle connections [17-Sep-2019 00:23:02] NOTICE: systemd monitor interval set to 10000ms [17-Sep-2019 00:31:28] ERROR: An another FPM instance seems to already listen on /var/run/php5-fpm.sock [17-Sep-2019 00:31:28] ERROR: FPM initialization failed [17-Sep-2019 00:37:34] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful
隨后在nginx配置文件中改用第二種sock文件交互的模式,發(fā)現(xiàn)還是頁(yè)面解析不了。
最后找到/etc/php5/fpm/pool.d/www.conf 配置文件,將listen改為127.0.0.1:9000
又將nginx改回用端口監(jiān)聽(tīng)的方式,重啟nginx和php-fpm以后,終于可以解析php腳本了。。
root@ubuntu:/usr/local/nginx# netstat -tln Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN tcp6 0 0 ::1:631 :::* LISTEN root@ubuntu:/usr/local/nginx# pgrep nginx|xargs kill -s 9 root@ubuntu:/usr/local/nginx# vim conf/nginx.conf root@ubuntu:/usr/local/nginx# sbin/nginx root@ubuntu:/usr/local/nginx#
nginx.conf配置文件
server {
listen 80;
server_name localhost;
root html;
index index.php;
location ~\.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
/etc/php5/fpm/pool.d/www.conf文件修改的地方:
; The address on which to accept FastCGI requests. ; Valid syntaxes are: ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on ; a specific port; ; 'port' - to listen on a TCP socket to all addresses on a ; specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. listen = 127.0.0.1:9000
網(wǎng)站標(biāo)題:php9000端口沒(méi)有啟動(dòng)怎么辦
轉(zhuǎn)載注明:http://www.fisionsoft.com.cn/article/dheoepo.html


咨詢
建站咨詢
