问题
I'm running a blog on subdomain. "blog.ourcompanyname.com".
Wordpress folder is located under "/var/www/wordpress"
Apache instance is running on 8081 port (manually configured) and being proxy passed by Nginx (which runs on 80 port). The reason we need NGINX is because we are running a second application on the same server (VPS, Ubuntu 12.04 LTS), and it is not a "PHP" application.
Now, everything is working smooth: you can access different pages, static content (pictures, etc) are working.
BUT, here comes the tough part:
If I enable permalinks (because default links are horrible) - regardless of what I put in the URL, I end up on the first (front) page!
It can be anything: e.g, blog.ourcompanyname.com/2013/11/hello-world/ or blog.ourcompanyname.com/bla-bla-bla-bla/
I don't get 500 or 404 error. And that is creepy.
This is our APACHE2 virtual host config file:
<VirtualHost *:8081>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/wordpress
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/wordpress/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
And this is our NGINX config file:
server {
server_name blog.ourcompanyname.com;
access_log /var/log/nginx/blog.ourcompanyname.com.access.log main;
error_log /var/log/nginx/blog.ourcompanyname.com.error.log;
root /var/www/wordpress; # Wordpress blog
location / {
index index.php;
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~ \.php$ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:8081;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
The .htaccess file is being generated by means of wordpress, so we don't touch it at all. But for sake of testing I've also tried to change the RewriteBase from "/" to "/wordpress/" and other stuff that has something to do with directories, but no avail.
Please, HELP!
来源:https://stackoverflow.com/questions/20262348/wordpress-permalinks-do-not-work-no-errors