Changing port on which Nginx listens?

Gilles Ganault gilles.ganault at free.fr
Fri Jul 16 12:39:17 MSD 2010


Hello

I wanted to move from 80 to 8787, and now, Nginx redirects to 80 and
replies with 301 :-/

# /etc/init.d/nginx stop

# vi /etc/nginx/sites-available/default
server {
    listen 8787 default;
    
# /etc/init.d/nginx start

# netstat -nat
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address State
tcp        0      0 0.0.0.0:2000            0.0.0.0:* LISTEN     
tcp        0      0 0.0.0.0:8787            0.0.0.0:* LISTEN     

>From remote Windows host: http://192.168.0.8:8787/
192.168.0.1 - - [16/Jul/2010:03:55:53 +0200] "GET / HTTP/1.1" 301 5
"-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.4)
Gecko/20100611 Firefox/3.6.4"

Any idea how to configure Nginx accordingly?

Thank you.




More information about the nginx mailing list