Welcome! Log In Create A New Profile


No access to nginx server from www

Posted by calvin4242 
No access to nginx server from www
September 18, 2019 06:24PM
I installed a LEMP server on an odroid c2 (LEMP=Nginx, mariadb, phpmyadmin, php-fpm et wordpress).
Eveything is woking in my home local network but i cannot access server from outside my local network.
To have access to the server from the www, having a classical internet box routed, I've assigned a fixed ip to the server (192.168.0.xx) and redirected port 80 for this ip in tcp.
I also took a free domain name for the public IP of my freebox.(IP xxx.xxx.xxx.xxx -> my-site.ocry.com).

This domain name is well registered and active in the parameters of my internet box provider (Reverse DNS custom).
When I test from the www url site (www.domain name or public IP port 80) it fails and I have a page: "This site is inaccessible, took too long to answer".
it's been 4 days that I can not find a solution; thanks for any help;

I went to https://ping.eu/,
a DNS lookup on the domain name refers to the public IP of my BOX.
a PING is successful
a port check tells me that port 80 and 8080 are open.

here is my server config in /etc/sites-available/my-site

server {
listen 80;
listen [::]:80;

server_name my-site.ocry.com;
root /var/www/my-site;

index index.php index.html;

location / {
try_files $uri $uri/ /index.php?$args;
location ~ \.php$ {
try_files $uri =404;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
fastcgi_read_timeout 600;
Re: No access to nginx server from www
September 21, 2019 02:41PM
It sounds to me like one of these things fail

(1) The public IP address of your home network changes because of DSL/whatever reconnects, but this is not reflected in the A record of your DNS entry for the domain. => check dynamic DNS options to reflect changes in the home network public IP address in the DNS record.

(2) There is a problem with port forwarding from your NAT router to your local server. => check the port forwarding, e.g., from your mobile, and see if calling the web site address gets logged in your NGINX access.log

(3) Your local server is not aware of its public DNS name, so it will create URLs that refer to localhost ( => Check the configuration of your host to handle this properly, or use the proxy_redirect directive to rewrite URLs to respect your public DNS name (https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect).

Re: No access to nginx server from www
September 22, 2019 09:31AM
Hello j94305,

(1) my Public IP adress is static for sure .
(2) port forwarding is absolutely ok (a port check tells me that port 80 and 8080 are open for my server ip).
(3) host is correctly configured


In wordpress, edit wp-config and add:

define( 'WP_HOME', 'http://my-site.com' );
define( 'WP_SITEURL', 'http://my-site.com' );


in phpmyadmin go to wp-options table and search in "option name" column for HOME URL et SITEURL.
Changed to http://my-site.com for each and clik execute each time.

Made a:

curl -I http://my-site.com

gave a:

$[i] curl -I http://mon-site.ocry.com
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
HTTP/1.1 200 OK
Server: nginx/1.14.0 (Ubuntu)
Date: Sun, 22 Sep 2019 12:25:57 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Link: http://http://my-site.com/index.php?rest_route=/; rel="https://api.w.org/"

You can see on last line LINK that there are 2 http://
So i made in server a:

sudo systemctl restart php7.2-fpm.service
sudo systemctl restart nginx.service
sudo systemctl restart mariadb.service

And in the phone i used (to connect externaly to the server) erases all navigator cache.

That all. Thank you. Does I need to mark this as solved in title?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 97
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready