'How to remotely access Wordpress app by local domain name?

I have installed Wordpress via docker-compose on my RaspberryPi server. Wordpress is listening on port 8084 and has address:

WordPress Address (URL) http://dev.nemoz.info
Site Address (URL)      http://dev.nemoz.info

Docker:

$ docker ps -a |grep nemoz-dev
482d607398ae        wordpress:cli                    "docker-entrypoint.s…"   2 days ago          Created                                                                nemoz-dev_wpcli-dev_1
b5afb4f30d1e        jackgruber/phpmyadmin:armhf      "/run.sh phpmyadmin"     2 days ago          Created                                                                nemoz-dev_phpadmin-dev_1
e7798d8af0e3        nemoz-dev_wordpress-dev          "docker-entrypoint.s…"   2 days ago          Up 4 hours               0.0.0.0:8084->80/tcp, 0.0.0.0:8443->443/tcp   nemoz-dev_wordpress-dev_1
6bf6de12a2f4        hypriot/rpi-mysql                "/entrypoint.sh --ma…"   2 days ago          Up 2 days                0.0.0.0:3307->3306/tcp                        nemoz-dev_db-dev_1

The problem is that the page http://dev.nemoz.info is not opening from another computer (Ubuntu) in local network.

From Ubuntu in Chrome browser I get error: ERR_CONNECTION_REFUSED I run tcpdump in Ubuntu and after entering addresss http://dev.nemoz.info:

$ sudo tcpdump -n port 80 or port 8084
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on enp0s3, link-type EN10MB (Ethernet), snapshot length 262144 bytes
14:03:24.446862 IP 192.168.2.81.37590 > 192.168.1.10.80: Flags [S], seq 1764017390, win 64240, options [mss 1460,sackOK,TS val 4112938789 ecr 0,nop,wscale 7], length 0
14:03:24.518325 IP 192.168.1.10.80 > 192.168.2.81.37590: Flags [R.], seq 0, ack 1764017391, win 0, length 0
14:03:25.659272 IP 192.168.2.81.37592 > 192.168.1.10.80: Flags [S], seq 4205669159, win 64240, options [mss 1460,sackOK,TS val 4112940002 ecr 0,nop,wscale 7], length 0
14:03:25.748020 IP 192.168.1.10.80 > 192.168.2.81.37592: Flags [R.], seq 0, ack 4205669160, win 0, length 0
14:03:30.777466 IP 192.168.2.81.37594 > 192.168.1.10.80: Flags [S], seq 3328966367, win 64240, options [mss 1460,sackOK,TS val 4112945120 ecr 0,nop,wscale 7], length 0
14:03:30.790193 IP 192.168.1.10.80 > 192.168.2.81.37594: Flags [R.], seq 0, ack 3328966368, win 0, length 0

Looks like the page is not trying to connect via port 8084.

In Lynx:

$ lynx dev.nemoz.info

Looking up dev.nemoz.info first
Looking up dev.nemoz.info
Making HTTP connection to dev.nemoz.info
Sending HTTP request.
HTTP request sent; waiting for response.
HTTP/1.1 301 Moved Permanently
Data transfer complete
HTTP/1.1 301 Moved Permanently
Using http://dev.nemoz.info:8084/
Looking up dev.nemoz.info:8084
Making HTTP connection to dev.nemoz.info:8084
Alert!: Unable to connect to remote host.

lynx: Can't access startfile http://dev.nemoz.info/

Wordpress admin page is opening fine via address: http://dev.nemoz.info/wp-admin/

Wordpress application is also opening via address http://192.168.1.10:8084, but not via address http://dev.nemoz.info

In Ubuntu I added entry dev.nemoz.info into /etc/hosts:

$ cat /etc/hosts
127.0.0.1   localhost
127.0.0.1   dev.nemoz.info

And created Nginx reverse proxy:

$ cat /etc/nginx/sites-enabled/devnemoz.conf     
server { 
    listen 80;
    
    server_name dev.nemoz.info;
 
    location / {

    proxy_pass http://192.168.1.10:8084;

    proxy_set_header Host $host;

    proxy_set_header X-Real-IP $remote_addr;

    proxy_set_header X-Forwarded-For $remote_addr;

    proxy_set_header X-Forwarded-Proto $scheme;

    proxy_set_header X-Forwarded-Host $host;

    proxy_set_header X-Forwarded-Server $host;

    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    }

}


Solution 1:[1]

Somehow it started working. I changed only the Nginx configuration to this:

$ cat /etc/nginx/sites-enabled/devnemoz.info     
server {
    listen 80;

    server_name dev.nemoz.info;

    location / {
        proxy_pass http://192.168.1.10:8084;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        #proxy_redirect http://192.168.1.10:8084 http://dev.nemoz.info;
    }
}

Then in incognito mode in Chrome (same before didn't work) I entered address dev.nemoz.info and the Wordpress page opened.

Log from curl:

$ curl -I dev.nemoz.info
HTTP/1.1 200 OK
Server: nginx/1.18.0 (Ubuntu)
Date: Mon, 02 May 2022 21:31:30 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/7.2.18
Link: <http://dev.nemoz.info/wp-json/>; rel="https://api.w.org/"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 nagard