我是Docker的新手。
我为Wordpress开发设置了自定义环境,所有设置都正确。
localhost
显示预期,Wordpress可以连接到数据库。
但是localhost/subpage
会返回404错误,我错过了什么吗?
搬运工-compose.yml
version: "3"
services:
webserver:
build:
context: ./bin/webserver
container_name: 'dp-server'
restart: 'always'
ports:
- "80:80"
- "443:443"
links:
- mysql
volumes:
- /Users/albert/www/:/var/www/html
mysql:
build: ./bin/mysql
container_name: 'dp-mysql'
restart: 'always'
ports:
- "3306:3306"
volumes:
- ${MYSQL_DATA_DIR-./data/mysql}:/var/lib/mysql
- ${MYSQL_LOG_DIR-./logs/mysql}:/var/log/mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: root
MYSQL_PASSWORD: root
Dockerfile
FROM php:5.6-apache
RUN apt-get -y update --fix-missing
RUN apt-get upgrade -y
#Install mysql integration
RUN apt-get -y install libsqlite3-dev libsqlite3-0 mysql-client
RUN docker-php-ext-install pdo_mysql
RUN docker-php-ext-install pdo_sqlite
RUN docker-php-ext-install mysqli
答案 0 :(得分:1)
登录wordpress管理面板
转到设置»永久链接,然后选择帖子名称单选按钮(确认给出的ip / dns名称) 然后单击“保存”按钮。
如果没有解决,请在.htaccess中进行更改
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>