0

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!

Dmitri
  • 2,451
  • 6
  • 35
  • 55
  • Do you have a 404.php file in your theme folder? If you don't all 404 it will show your index.php file if I recall correctly. – WebNovice Nov 28 '13 at 09:36
  • @WebNovice Yes, there is a 404.php file in the theme directory. The theme we are using is called "suburbia", so you can check it our yourself. But, this blog didn't work even with the default theme. – Dmitri Nov 28 '13 at 09:47
  • You mean when you go to `blog.companyname.com/what-not` you get redirected to `blog.companyname.com` or do you see your first page on `blog.company.com/what-not`. – WebNovice Nov 28 '13 at 09:55
  • @WebNovice I'm not getting redirected anywhere, I just see the first page. Just to let you know, I have installed a plugin that disabled canonical redirects, because we had a problem with it - http://stackoverflow.com/questions/19979843/wordpress-nginx-redirect-loop/19980354 – Dmitri Nov 28 '13 at 10:00

0 Answers0