Nginx not available from localhost, but available by network
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
Have server with installed nginx and php-fpm. Some sctript need access to part of site via curl. But it fails. I tried to run curl on server :
curl -v -i alexcoder.info
* About to connect() to alexcoder.info port 80 (#0)
* Trying 88.198.156.238...
* Connection refused
* couldn't connect to host
* Closing connection #0
curl: (7) couldn't connect to host
But from network sites available :
curl -v -i alexcoder.info
* Rebuilt URL to: alexcoder.info/
* Adding handle: conn: 0x702b10
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x702b10) send_pipe: 1, recv_pipe: 0
* About to connect() to alexcoder.info port 80 (#0)
* Trying 88.198.156.238...
* Connected to alexcoder.info (88.198.156.238) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.32.0
> Host: alexcoder.info
> Accept: */*
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
nginx logs does not contain any errors aboout this. I tried to flush iptables rules but it take no effect.
What it may be?
php nginx
add a comment |
up vote
2
down vote
favorite
Have server with installed nginx and php-fpm. Some sctript need access to part of site via curl. But it fails. I tried to run curl on server :
curl -v -i alexcoder.info
* About to connect() to alexcoder.info port 80 (#0)
* Trying 88.198.156.238...
* Connection refused
* couldn't connect to host
* Closing connection #0
curl: (7) couldn't connect to host
But from network sites available :
curl -v -i alexcoder.info
* Rebuilt URL to: alexcoder.info/
* Adding handle: conn: 0x702b10
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x702b10) send_pipe: 1, recv_pipe: 0
* About to connect() to alexcoder.info port 80 (#0)
* Trying 88.198.156.238...
* Connected to alexcoder.info (88.198.156.238) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.32.0
> Host: alexcoder.info
> Accept: */*
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
nginx logs does not contain any errors aboout this. I tried to flush iptables rules but it take no effect.
What it may be?
php nginx
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
Have server with installed nginx and php-fpm. Some sctript need access to part of site via curl. But it fails. I tried to run curl on server :
curl -v -i alexcoder.info
* About to connect() to alexcoder.info port 80 (#0)
* Trying 88.198.156.238...
* Connection refused
* couldn't connect to host
* Closing connection #0
curl: (7) couldn't connect to host
But from network sites available :
curl -v -i alexcoder.info
* Rebuilt URL to: alexcoder.info/
* Adding handle: conn: 0x702b10
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x702b10) send_pipe: 1, recv_pipe: 0
* About to connect() to alexcoder.info port 80 (#0)
* Trying 88.198.156.238...
* Connected to alexcoder.info (88.198.156.238) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.32.0
> Host: alexcoder.info
> Accept: */*
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
nginx logs does not contain any errors aboout this. I tried to flush iptables rules but it take no effect.
What it may be?
php nginx
Have server with installed nginx and php-fpm. Some sctript need access to part of site via curl. But it fails. I tried to run curl on server :
curl -v -i alexcoder.info
* About to connect() to alexcoder.info port 80 (#0)
* Trying 88.198.156.238...
* Connection refused
* couldn't connect to host
* Closing connection #0
curl: (7) couldn't connect to host
But from network sites available :
curl -v -i alexcoder.info
* Rebuilt URL to: alexcoder.info/
* Adding handle: conn: 0x702b10
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x702b10) send_pipe: 1, recv_pipe: 0
* About to connect() to alexcoder.info port 80 (#0)
* Trying 88.198.156.238...
* Connected to alexcoder.info (88.198.156.238) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.32.0
> Host: alexcoder.info
> Accept: */*
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
nginx logs does not contain any errors aboout this. I tried to flush iptables rules but it take no effect.
What it may be?
php nginx
php nginx
asked Feb 26 '14 at 21:41
alexgauss1994
6317
6317
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
Multiple servers
You need to setup a listener for each network interface you want Nginx to respond to:
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location /
root html;
index index.html index.htm;
You likely already have a server ..
section that's listening on the actual interface that your system binds to when it gets an IP address.
Multiple listeners
You can also add multiple Listen
lines to a server ..
section like so:
Examples
listen *:80;
or
listen localhost:80;
listen 127.0.0.1:80;
listen 12.34.56.78:80;
I would likely do it using this second method! See this article for more examples, titled: - Basic Nginx Configuration.
References
- Server Names - Nginx Documentation
- Server Block Examples
- NGINX multiple server blocks with reverse proxy
- Basic Nginx Configuration
@alexgauss1994 - yup, thanks for the Q!
– slm♦
Feb 26 '14 at 22:16
add a comment |
up vote
-1
down vote
I have also facing same issue. I have configure the file in sites-enabled. The file configuration is given below.
upstream backend
server localhost:3000;
we're in the http context here
map $http_upgrade $connection_upgrade
# default upgrade;
# '' close;
server
listen 81 default_server;
# listen [::]:81 default_server;
listen 80;
server_name track.xxxxxxxxxx.com;
server_tokens off;
return 301 https://$host$request_uri;
the secure nginx server instance
server
# listen 443 ssl;
# ssl_certificate /etc/ssl/certs/.domainName.1.2018.chain.crt;
# ssl_certificate_key /etc/ssl/private/.domainName.1.key;
#server_name xyz;
# location /
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header Host $http_host;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection $connection_upgrade;
# proxy_set_header X-NginX-Proxy true;
# proxy_set_header X-Ssl on;
# proxy_pass http://localhost:3000;
# proxy_redirect off;
#
the secure nginx server instance
server
listen 443 ssl;
ssl_certificate /etc/ssl/certs/.domainName.1.2018.chain.crt;
ssl_certificate_key /etc/ssl/private/.domain.1.key;
listen 80 default_server;
server_name track.xxxxxxxxxx.com;
server_name _;
location /
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Ssl on;
proxy_pass http://localhost:3000;
proxy_redirect off;
server
listen 7003;
server_name localhost;
root /opt/ClientFolder/;
location /
try_files $uri @backend;
location @backend
proxy_pass https://backend;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Following is necessary for Websocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
Please do needful.
New contributor
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Multiple servers
You need to setup a listener for each network interface you want Nginx to respond to:
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location /
root html;
index index.html index.htm;
You likely already have a server ..
section that's listening on the actual interface that your system binds to when it gets an IP address.
Multiple listeners
You can also add multiple Listen
lines to a server ..
section like so:
Examples
listen *:80;
or
listen localhost:80;
listen 127.0.0.1:80;
listen 12.34.56.78:80;
I would likely do it using this second method! See this article for more examples, titled: - Basic Nginx Configuration.
References
- Server Names - Nginx Documentation
- Server Block Examples
- NGINX multiple server blocks with reverse proxy
- Basic Nginx Configuration
@alexgauss1994 - yup, thanks for the Q!
– slm♦
Feb 26 '14 at 22:16
add a comment |
up vote
2
down vote
accepted
Multiple servers
You need to setup a listener for each network interface you want Nginx to respond to:
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location /
root html;
index index.html index.htm;
You likely already have a server ..
section that's listening on the actual interface that your system binds to when it gets an IP address.
Multiple listeners
You can also add multiple Listen
lines to a server ..
section like so:
Examples
listen *:80;
or
listen localhost:80;
listen 127.0.0.1:80;
listen 12.34.56.78:80;
I would likely do it using this second method! See this article for more examples, titled: - Basic Nginx Configuration.
References
- Server Names - Nginx Documentation
- Server Block Examples
- NGINX multiple server blocks with reverse proxy
- Basic Nginx Configuration
@alexgauss1994 - yup, thanks for the Q!
– slm♦
Feb 26 '14 at 22:16
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Multiple servers
You need to setup a listener for each network interface you want Nginx to respond to:
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location /
root html;
index index.html index.htm;
You likely already have a server ..
section that's listening on the actual interface that your system binds to when it gets an IP address.
Multiple listeners
You can also add multiple Listen
lines to a server ..
section like so:
Examples
listen *:80;
or
listen localhost:80;
listen 127.0.0.1:80;
listen 12.34.56.78:80;
I would likely do it using this second method! See this article for more examples, titled: - Basic Nginx Configuration.
References
- Server Names - Nginx Documentation
- Server Block Examples
- NGINX multiple server blocks with reverse proxy
- Basic Nginx Configuration
Multiple servers
You need to setup a listener for each network interface you want Nginx to respond to:
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location /
root html;
index index.html index.htm;
You likely already have a server ..
section that's listening on the actual interface that your system binds to when it gets an IP address.
Multiple listeners
You can also add multiple Listen
lines to a server ..
section like so:
Examples
listen *:80;
or
listen localhost:80;
listen 127.0.0.1:80;
listen 12.34.56.78:80;
I would likely do it using this second method! See this article for more examples, titled: - Basic Nginx Configuration.
References
- Server Names - Nginx Documentation
- Server Block Examples
- NGINX multiple server blocks with reverse proxy
- Basic Nginx Configuration
edited May 23 '17 at 12:40
Community♦
1
1
answered Feb 26 '14 at 22:01
slm♦
245k66505671
245k66505671
@alexgauss1994 - yup, thanks for the Q!
– slm♦
Feb 26 '14 at 22:16
add a comment |
@alexgauss1994 - yup, thanks for the Q!
– slm♦
Feb 26 '14 at 22:16
@alexgauss1994 - yup, thanks for the Q!
– slm♦
Feb 26 '14 at 22:16
@alexgauss1994 - yup, thanks for the Q!
– slm♦
Feb 26 '14 at 22:16
add a comment |
up vote
-1
down vote
I have also facing same issue. I have configure the file in sites-enabled. The file configuration is given below.
upstream backend
server localhost:3000;
we're in the http context here
map $http_upgrade $connection_upgrade
# default upgrade;
# '' close;
server
listen 81 default_server;
# listen [::]:81 default_server;
listen 80;
server_name track.xxxxxxxxxx.com;
server_tokens off;
return 301 https://$host$request_uri;
the secure nginx server instance
server
# listen 443 ssl;
# ssl_certificate /etc/ssl/certs/.domainName.1.2018.chain.crt;
# ssl_certificate_key /etc/ssl/private/.domainName.1.key;
#server_name xyz;
# location /
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header Host $http_host;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection $connection_upgrade;
# proxy_set_header X-NginX-Proxy true;
# proxy_set_header X-Ssl on;
# proxy_pass http://localhost:3000;
# proxy_redirect off;
#
the secure nginx server instance
server
listen 443 ssl;
ssl_certificate /etc/ssl/certs/.domainName.1.2018.chain.crt;
ssl_certificate_key /etc/ssl/private/.domain.1.key;
listen 80 default_server;
server_name track.xxxxxxxxxx.com;
server_name _;
location /
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Ssl on;
proxy_pass http://localhost:3000;
proxy_redirect off;
server
listen 7003;
server_name localhost;
root /opt/ClientFolder/;
location /
try_files $uri @backend;
location @backend
proxy_pass https://backend;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Following is necessary for Websocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
Please do needful.
New contributor
add a comment |
up vote
-1
down vote
I have also facing same issue. I have configure the file in sites-enabled. The file configuration is given below.
upstream backend
server localhost:3000;
we're in the http context here
map $http_upgrade $connection_upgrade
# default upgrade;
# '' close;
server
listen 81 default_server;
# listen [::]:81 default_server;
listen 80;
server_name track.xxxxxxxxxx.com;
server_tokens off;
return 301 https://$host$request_uri;
the secure nginx server instance
server
# listen 443 ssl;
# ssl_certificate /etc/ssl/certs/.domainName.1.2018.chain.crt;
# ssl_certificate_key /etc/ssl/private/.domainName.1.key;
#server_name xyz;
# location /
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header Host $http_host;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection $connection_upgrade;
# proxy_set_header X-NginX-Proxy true;
# proxy_set_header X-Ssl on;
# proxy_pass http://localhost:3000;
# proxy_redirect off;
#
the secure nginx server instance
server
listen 443 ssl;
ssl_certificate /etc/ssl/certs/.domainName.1.2018.chain.crt;
ssl_certificate_key /etc/ssl/private/.domain.1.key;
listen 80 default_server;
server_name track.xxxxxxxxxx.com;
server_name _;
location /
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Ssl on;
proxy_pass http://localhost:3000;
proxy_redirect off;
server
listen 7003;
server_name localhost;
root /opt/ClientFolder/;
location /
try_files $uri @backend;
location @backend
proxy_pass https://backend;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Following is necessary for Websocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
Please do needful.
New contributor
add a comment |
up vote
-1
down vote
up vote
-1
down vote
I have also facing same issue. I have configure the file in sites-enabled. The file configuration is given below.
upstream backend
server localhost:3000;
we're in the http context here
map $http_upgrade $connection_upgrade
# default upgrade;
# '' close;
server
listen 81 default_server;
# listen [::]:81 default_server;
listen 80;
server_name track.xxxxxxxxxx.com;
server_tokens off;
return 301 https://$host$request_uri;
the secure nginx server instance
server
# listen 443 ssl;
# ssl_certificate /etc/ssl/certs/.domainName.1.2018.chain.crt;
# ssl_certificate_key /etc/ssl/private/.domainName.1.key;
#server_name xyz;
# location /
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header Host $http_host;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection $connection_upgrade;
# proxy_set_header X-NginX-Proxy true;
# proxy_set_header X-Ssl on;
# proxy_pass http://localhost:3000;
# proxy_redirect off;
#
the secure nginx server instance
server
listen 443 ssl;
ssl_certificate /etc/ssl/certs/.domainName.1.2018.chain.crt;
ssl_certificate_key /etc/ssl/private/.domain.1.key;
listen 80 default_server;
server_name track.xxxxxxxxxx.com;
server_name _;
location /
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Ssl on;
proxy_pass http://localhost:3000;
proxy_redirect off;
server
listen 7003;
server_name localhost;
root /opt/ClientFolder/;
location /
try_files $uri @backend;
location @backend
proxy_pass https://backend;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Following is necessary for Websocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
Please do needful.
New contributor
I have also facing same issue. I have configure the file in sites-enabled. The file configuration is given below.
upstream backend
server localhost:3000;
we're in the http context here
map $http_upgrade $connection_upgrade
# default upgrade;
# '' close;
server
listen 81 default_server;
# listen [::]:81 default_server;
listen 80;
server_name track.xxxxxxxxxx.com;
server_tokens off;
return 301 https://$host$request_uri;
the secure nginx server instance
server
# listen 443 ssl;
# ssl_certificate /etc/ssl/certs/.domainName.1.2018.chain.crt;
# ssl_certificate_key /etc/ssl/private/.domainName.1.key;
#server_name xyz;
# location /
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header Host $http_host;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection $connection_upgrade;
# proxy_set_header X-NginX-Proxy true;
# proxy_set_header X-Ssl on;
# proxy_pass http://localhost:3000;
# proxy_redirect off;
#
the secure nginx server instance
server
listen 443 ssl;
ssl_certificate /etc/ssl/certs/.domainName.1.2018.chain.crt;
ssl_certificate_key /etc/ssl/private/.domain.1.key;
listen 80 default_server;
server_name track.xxxxxxxxxx.com;
server_name _;
location /
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Ssl on;
proxy_pass http://localhost:3000;
proxy_redirect off;
server
listen 7003;
server_name localhost;
root /opt/ClientFolder/;
location /
try_files $uri @backend;
location @backend
proxy_pass https://backend;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Following is necessary for Websocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
Please do needful.
New contributor
New contributor
answered Nov 22 at 7:47
Kunal Differential Edge
1
1
New contributor
New contributor
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f117128%2fnginx-not-available-from-localhost-but-available-by-network%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown