Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wordpress image #215

Closed
vicmosin opened this issue Apr 10, 2017 · 7 comments
Closed

Wordpress image #215

vicmosin opened this issue Apr 10, 2017 · 7 comments

Comments

@vicmosin
Copy link

I installed an official WP docker container. Container running in front of nginx instance.

Here is the .htaccess file that I inject to container:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
</IfModule>

Nginx just proxies /wp to appropriate path. The problem is the following: https://example.com/wp/ and https://example.com/wp/hello-post/ work fine. But once I try to get an access to https://example.com/wp/wp-admin/ it redirects me all the time to https://example.com/wp-admin/ i.e. ignores wp subfolder.. I tried to use .htaccess which comes by default - exactly same story.

The full description is here

@Douglasdc3
Copy link

This issue could be due to the configuration of the apache2.conf

<Directory /var/www/>
	Options Indexes FollowSymLinks
	AllowOverride None
	Require all granted
</Directory>

Apache2 will actually not read the .htaccess file at all.

Could be related to #158 (is closed but with the latest worpress image the issue does not seem to be fixed)

@yosifkit
Copy link
Member

That is in the apache2.conf, but that should be overridden by the other config file:

$ cat /etc/apache2/conf-enabled/docker-php.conf 
<FilesMatch \.php$>
	SetHandler application/x-httpd-php
</FilesMatch>

DirectoryIndex disabled
DirectoryIndex index.php index.html

<Directory /var/www/>
	Options -Indexes
	AllowOverride All
</Directory>

@vicmosin
Copy link
Author

.htaccess seems to work indeed.. The interesting thing is that it happens only inside wp-admin area.. i.e. even links on the main page are fine (check out the attachment) But one I click on one of the links it redirects me to wp-admin without subfolder

bildschirmfoto 2017-04-11 um 07 38 47

@tianon
Copy link
Member

tianon commented Apr 25, 2017

Were your permalinks setup properly? In my experience, a given WordPress install is very picky about where it was initially installed, and isn't a fan of being moved (see https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory#Method_II_.28With_URL_change.29 for some tips/docs around that).

@vicmosin
Copy link
Author

@Douglasdc3 @yosifkit Yeah, I can confirm that cat /etc/apache2/conf-enabled/docker-php.conf gives me

<Directory /var/www/>
	Options -Indexes
	AllowOverride All
</Directory>

so values in apache2.conf should be indeed overriden.
But sill have the issue.. Any other ideas?

@tianon
Copy link
Member

tianon commented Jan 10, 2018

Sorry for the delay.

Do you have a simple way to reproduce the issue? I haven't seen any issues in the usage of this container with .htaccess or permalinks in my now several years of usage, so having a way to reproduce this issue would be really helpful to figuring out what's going on in your environment.

You'll probably also have more luck getting timely responses from the Docker Community Forums, the Docker Community Slack, or Stack Overflow (since this is an issue tracker, not a support forum, and we typically have a high volume of filed issues to try to keep up with).

@tianon
Copy link
Member

tianon commented Apr 19, 2018

Closing since there doesn't seem to be anything actionable we can fix here -- as noted above, please try the forums, etc if there's additional information available which could help other folks debug (or at least reproduce) the issue.

@tianon tianon closed this as completed Apr 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants