-1

I had Ngxin working just fine. But now I want to change my site to another port. I tried with my Drupal site and my bare-bone php script site. Both not working.

My vhost is simple.

server
{
  listen       81;
  server_name  wiki.domain.com;
  index        index.php index.html index.htm;
  root         /opt/www/domain_wiki;
  error_page 404 = @drupal;

  location @drupal {
     rewrite ^/(.*)$ /index.php?q=$1 last;
  }

  location ~ .*\.(php|php5)?$
  {
    fastcgi_pass  127.0.0.1:9000;
    fastcgi_index index.php;
    include       fastcgi.conf;
  }
  access_log logs/domain_wiki.log main;
}

What I did is only changing 80 to 81.

I tried to test the port. It seems just fine.

# nc -z localhost 81
Connection to localhost 81 port [tcp/hosts2-ns] succeeded!

I restart, reload, -t Nginx. All fine.

Ideas?

# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:http
RH-Firewall-1-INPUT  all  --  anywhere             anywhere

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
RH-Firewall-1-INPUT  all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain RH-Firewall-1-INPUT (2 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     icmp --  anywhere             anywhere            icmp any
ACCEPT     esp  --  anywhere             anywhere
ACCEPT     ah   --  anywhere             anywhere
ACCEPT     udp  --  anywhere             224.0.0.251         udp dpt:mdns
ACCEPT     udp  --  anywhere             anywhere            udp dpt:ipp
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ipp
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTAB                                 LISHED
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:f                                 tp
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:s                                 sh
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:h                                 ttps
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:h                                 ttp
REJECT     all  --  anywhere             anywhere            reject-with icmp-ho                                 st-prohibited

closed as off-topic by devicenull, MDMarra, Iain, TheCleaner, mdpc Jul 28 '13 at 18:02

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must demonstrate a minimal understanding of the problem being solved. Try including attempted solutions, why they didn't work, and the expected results. See How can I ask better questions on Server Fault? for further guidance." – devicenull, MDMarra, Iain, TheCleaner, mdpc
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    What do you mean by "not working"? – Michael Hampton Jul 28 '13 at 0:43
  • Page is keeping "trying to connect", then failed - "cannot connect.." – Hao Jul 28 '13 at 0:45
  • Are you accessing it at example.com:81 or expecting it to work without the port in the URL? – ceejayoz Jul 28 '13 at 0:51
  • With the 81 in the URL like example.com:81 – Hao Jul 28 '13 at 0:55
0

Make sure the iptables rules allow traffic in to your machine on TCP/81 aswell.

For example:

Allow traffic in from anyone

iptables -I INPUT -p tcp --dport 81 -j ACCEPT
0

Do you have a firewall? Do you have something else listening on port 81? Are you running SELinux?

There is nothing in nginx that would cause problems like this, so you're looking for something at the OS level.

  • I don't know if I had firewall on this box. It's on local network. How to check it. I used "netstat -tulpn | grep :81". Nginx is listening. – Hao Jul 28 '13 at 1:15
  • I edited with iptables. Anything wrong about that? – Hao Jul 28 '13 at 1:19
  • I am running CentOS. – Hao Jul 28 '13 at 1:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.