https://hub.docker.com/_/wordpress
sudo docker inspect wp_notes_poweredbygnulinux_wpnotes_1 | grep IPAddr
"SecondaryIPAddresses": null,
"IPAddress": "",
"IPAddress": "172.18.0.3"
docker-compose.yml
===================
version: '3.1'
services:
wpnotes:
image: wordpress
restart: always
ports:
- 8080:80
environment:
WORDPRESS_DB_HOST: dbwpnotes
WORDPRESS_DB_USER: xxxxxxxxxx
WORDPRESS_DB_PASSWORD: yyyyyyyyyy
WORDPRESS_DB_NAME: dbwpnotes
volumes:
- wpnotes:/var/www/html
dbwpnotes:
image: mysql:5.7
restart: always
environment:
MYSQL_DATABASE: dbwpnotes
MYSQL_USER: xxxxxxxxxx
MYSQL_PASSWORD: yyyyyyyyyy
MYSQL_RANDOM_ROOT_PASSWORD: '1'
volumes:
- dbwpnotes:/var/lib/mysql
volumes:
wpnotes:
dbwpnotes:
--------------------------------------------
docker-compose up -d
sudo apt install net-tools
sudo netstat -plnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 58257/sshd: /usr/sb
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 59891/nginx: master
tcp 0 0 127.0.0.1:40403 0.0.0.0:* LISTEN 2777/containerd
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 58263/systemd-resol
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 56847/docker-proxy
tcp6 0 0 :::22 :::* LISTEN 58257/sshd: /usr/sb
tcp6 0 0 :::80 :::* LISTEN 59891/nginx: master
tcp6 0 0 :::8080 :::* LISTEN 56852/docker-proxy
wget http://172.18.0.3:8080
--2023-05-21 02:44:40-- http://172.18.0.3:8080/
Connecting to 172.18.0.3:8080... failed: Connection refused.
wget localhost:8080
--2023-05-21 02:43:10-- http://localhost:8080/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://notes.poweredbygnulinux.com/wp-admin/install.php [following]
wget http://172.18.0.3/
--2023-05-21 02:44:10-- http://172.18.0.3/
Connecting to 172.18.0.3:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://notes.poweredbygnulinux.com/wp-admin/install.php [following]
wp-config.php
define( 'WP_HOME', 'http://notes.poweredbygnulinux.com' );
define( 'WP_SITEURL', 'http://notes.poweredbygnulinux.com' );
sudo service nginx restart
/etc/nginx/sites-available/notes.poweredbygnulinux.com
# Virtual Host configuration for notes.poweredbygnulinux.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
server {
listen 80;
listen [::]:80;
server_name notes.poweredbygnulinux.com www.notes.poweredbygnulinux.com;
#root /var/www/html;
#index index.html;
#location / {
# try_files $uri $uri/ =404;
#}
location / {
proxy_pass http://172.18.0.3;
##proxy_pass http://localhost:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header X-Forwarded-Proto https;
#proxy_set_header X-Forwarded-Port 443;
proxy_set_header Host $host;
#proxy_set_header Ssl-Offloaded 1;
#proxy_set_header DBG-SSL 1;
#fastcgi_param HTTPS on;
}
}
Leave a Reply
You must be logged in to post a comment.