I have two websites running in my local computer:
App A: a wordpress app running in docker and is accessible from this: http://localhost:5000
App B: another app running in the local web server http://localhost:80
The problem is, when I try to access the wordpress control panel (http://localhost:5000/wp-admin), the browser shows NOT Found error, and the URL on the browser address bar shows "http://localhost/wp-admin/" (port 5000 automatically disappeared).
My guess is that the browser is trying to access wp-admin from App B (port 80) instead of App A (port 5000).
Why is that and how to force browser to use my specificed port?
I tested in both Chrome and Firefox, they behave the same.
This is my docker-compose.yml:
version: '3'
services:
service_website:
build: ./services/website
volumes:
- ./services/website/source:/var/www/app
- ./services/website/config/nginx.site.conf:/etc/nginx/conf.d/default.conf
ports:
- 5000:80
php:
build: ./services/php-fpm
volumes:
- ./services/website/source:/var/www/app
- ./services/php-fpm/config/php.ini:/usr/local/etc/php/php.ini
my nginx config:
server {
index index.html index.php;
listen 80 default_server;
server_name localhost php-docker.local;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/app/public;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}