简体   繁体   中英

Configuring IPtables for PHP-FPM

So I have a CentOS server with Nginx and now want to run Nginx with PHP-FPM. By default it's configured to port 9000 but I'm going to use 9001. I need to know how to open port 9001 for loopback in my iptables. Which of the following are correct, are they the same, or both wrong? Any help will be appreciated, thanks :)

iptables -A INPUT -p tcp -s 127.0.0.0 --dport 9001 -j ACCEPT

or

iptables -A INPUT -i lo --dport 9001 -j ACCEPT

You shouldn't need to open the firewall to connect to localhost, as it shouldn't be firewalled anyway (as a general rule).

But I would suggest following the above advice to use sockets instead.

Edit /etc/php5/fpm/php5-fpm.conf and search for these two lines:

listen = /var/run/php5-fpm.sock
;listen = 127.0.0.1:9000

Comment out the port one and uncomment the sock one - restart php-fpm :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM