Website URL for WordPress

User
version: '3.8'

networks:
wpbedrock:
driver: bridge

services:
# Nginx Service
nginx:
image: nginx:stable-alpine
container_name: ${APP_NAME}_nginx
ports:
– "2500:80"
links:
– php
volumes:
– ./bedrock:/var/www/html
– ./docker/nginx/site.conf:/etc/nginx/conf.d/default.conf:rw
– ./docker/logs/nginx:/var/logs/nginx:rw
depends_on:
– php
– mysql
networks:
– wpbedrock

# PHP Service
php:
build:
context: .
dockerfile: Dockerfile
container_name: ${APP_NAME}_php
volumes:
– ./bedrock:/var/www/html # Fixed typo in path
ports:
– "2501:9000"
networks:
– wpbedrock

# MySQL Service
mysql:
image: mysql:8.0
container_name: ${APP_NAME}_mysql_db
environment:
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
MYSQL_DATABASE: ${DB_NAME}
MYSQL_USER: ${DB_USER}
MYSQL_PASSWORD: ${DB_PASSWORD}
volumes:
– db_data:/var/lib/mysql
ports:
– "2502:3306"
networks:
– wpbedrock

# Adminer Service
adminer:
image: adminer
container_name: ${APP_NAME}_adminer
ports:
– "2530:8080"
restart: always
networks:
– wpbedrock

volumes:
db_data:
what is the url for website

Assistant
To access your WordPress Bedrock site, use the following URL based on the `nginx` service's port configuration:

http://localhost:2500

This URL should load your WordPress Bedrock application in the browser. Ensure your `site.conf` (Nginx configuration) is correctly set to serve the `bedrock` folder. If you encounter issues, check the Nginx logs in `./docker/logs/nginx`.

If you'd like assistance configuring the `site.conf`, let me know!

User
its rediecting to http://localhost:2501
Assistant
The redirection to `http://localhost:2501` might happen due to the configuration in your `site.conf` or because of how the `WP_HOME` and `WP_SITEURL` environment variables are set in your Bedrock setup.

Here's how to troubleshoot and fix this:

### 1. **Check `site.conf` (Nginx configuration)**
Ensure your `site.conf` file (Nginx configuration) does not include any redirect rules that might be pointing to port 2501.

Your `site.conf` should resemble the following structure:

server {
       listen 80;
       server_name localhost;

       root /var/www/html/web;
       index index.php;

       location / {
           try_files $uri $uri/ /index.php?$query_string;
       }

       location ~ .php$ {
           fastcgi_pass php:9000;
           fastcgi_index index.php;
           include fastcgi_params;
           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
       }

       location ~ /.ht {
           deny all;
       }
   }

– Make sure that `fastcgi_pass` is pointing to `php:9000` as in the example above.

### 2. **Check `.env` for Bedrock Configuration**

In your Bedrock setup, open the `.env` file located in the `bedrock` directory and verify the following values:

WP_HOME=http://localhost:2500
   WP_SITEURL=${WP_HOME}/wp

– Ensure that `WP_HOME` is set to `http://localhost:2500`, which matches the port mapped in your Docker `nginx` service.

### 3. **Restart the Docker Containers**

After making these changes, restart your Docker containers to apply the new configurations:

docker-compose down
   docker-compose up -d

After following these steps, try accessing `http://localhost:2500` again. Let me know if this resolves the issue or if you need further assistance!

Leave a Comment

Your email address will not be published. Required fields are marked *