Metalmine
Metalmine

Reputation: 81

Setting up a wiki but nginx is giving me problems

I'm trying to set up a wiki at wiki.lightenedblade.com when I try to go to that link, it gives me a 404 message

However, my configs and LocalSettings files seems to be in order just not the nginx configurations. here's my NginX configs:

    server {
            listen  80;
            server_name lightenedblade.com www.lightenedblade.com;
            root /home/metalmine/public_html/lightenedblade;

            location / {
                    autoindex on;
                    index index.html;
            }
        location ~ \.php$ {
                    fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;
                    fastcgi_index  index.php;
                    fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    autoindex on;
                    index index.php;
                    include        fastcgi.conf;
        }

    }

    server {
            server_name wiki.lightenedblade.com;
            root /home/metalmine/public_html/lightenedblade/w;

            # Location for the wiki's root
        location / {
            # Do this inside of a location so it can be negated
            location ~ \.php$ {
                try_files $uri $uri/ =404; # Don't let php execute non-existent php files
                include /etc/nginx/fastcgi_params;
                fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
            }
        }

        location /images {
            # Separate location for images/ so .php execution won't apply

            location ~ ^/images/thumb/(archive/)?[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ {
                # Thumbnail handler for MediaWiki
                # This location only matches on a thumbnail's url
                # If the file does not exist we use @thumb to run the thumb.php script
                try_files $uri $uri/ @thumb;
            }
        }
        location /images/deleted {
            # Deny access to deleted images folder
            deny    all;
        }

        # Deny access to folders MediaWiki has a .htaccess deny in
        location /cache       { deny all; }
        location /languages   { deny all; }
        location /maintenance { deny all; }
        location /serialized  { deny all; }

        # Just in case, hide .svn and .git too
        location ~ /.(svn|git)(/|$) { deny all; }

        # Hide any .htaccess files
        location ~ /.ht { deny all; }

        # Uncomment the following code if you wish to hide the installer/updater
        ## Deny access to the installer
        #location /mw-config { deny all; }

        # Handling for the article path
        location /wiki {
            include /etc/nginx/fastcgi_params;
            # article path should always be passed to index.php
            fastcgi_param SCRIPT_FILENAME   $document_root/index.php;
            fastcgi_pass  unix:/var/run/php-fpm/php-fpm.sock;
        }

        # Thumbnail 404 handler, only called by try_files when a thumbnail does not exist
        location @thumb {
            # Do a rewrite here so that thumb.php gets the correct arguments
            rewrite ^/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /thumb.php?f=$1&width=$2;
            rewrite ^/images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /thumb.php?f=$1&width=$2&archived=1;

            # Run the thumb.php script
            include /etc/nginx/fastcgi_params;
            fastcgi_param SCRIPT_FILENAME   $document_root/thumb.php;
            fastcgi_pass  unix:/var/run/php-fpm/php-fpm.sock;
        }

    }

And here's my LocalSettings: https://gist.github.com/3794836

Thank you for your time.

Upvotes: 0

Views: 1058

Answers (1)

Mikec
Mikec

Reputation: 196

What's the problem you're having exactly?

I do notice the secound "server" is not "listening"... you have server_name, but not a listen 80 for example...

Try nginx -t

It usually tell you if something is wrong in the config and where!

EDIT (Comment isn't very readable)

404 is not found... so the the server is listening but didn't find the page you requested (1).

I noticed you also have:

location / {
            # Do this inside of a location so it can be negated
            location ~ \.php$ {
                try_files $uri $uri/ =404; # Don't let php execute non-existent php files

(1) You requested the "root" of the mobile site so nginx will look for and "index.*"

But you don't have an "index.php"

You can add " index index.php;" assuming the mobile site is php and the file index.php exists of course

Hope this solves you problem

Upvotes: 1

Related Questions