Unerwartete Weiterleitung in Nginx und php5-fpm

Unerwartete Weiterleitung in Nginx und php5-fpm

Ich habe nicht viel Erfahrung mit Webhosting, wollte aber eine WordPress-Site einrichten, hatte jedoch Probleme mit einer unerwarteten Weiterleitung. Daher habe ich meine gesamte Nginx-Konfiguration gelöscht, erhalte aber immer noch die Weiterleitung. Ich weiß nicht genau, wie das geht, da ich keine Möglichkeit zur Weiterleitung finden kann.

Hier ist, was ich habe:

nginx.conf:

user www-data;
worker_processes 4;
pid /var/run/nginx.pid;

events {
        worker_connections 768;
}

http {

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;


        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        gzip off;
        gzip_disable "msie6";

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}

Nur eine in meinem Sites-enabled-Ordner

sites-enabled# ls
wordpress

server {
        listen   80;

        access_log /var/log/nginx/wordpress-access.log;
        error_log /var/log/nginx/wordpress-error.log;

        root /var/www/wordpress;
        index index.php index.html index.htm;

        server_name localhost;

        location / {
                try_files $uri $uri/ /index.php?q=$uri&$args;
        }

        error_page 404 /404.html;

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
              root /usr/share/nginx/www;
        }

        # pass the PHP scripts to FastCGI server listening on a UNIX socket
        location ~ \.php$ {
                #fastcgi_pass 127.0.0.1:9000;
                # With php5-fpm:
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi.conf;
        }
}

fastcgi.conf:

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  HTTPS              $https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

Der WordPress-Ordner ist lediglich der Standard-Download:

/var/www/wordpress# ls -la
total 188
drwxr-xr-x  5 www-data www-data  4096 Oct  6 10:52 .
drwxrwxrwx 54 www-data root      4096 Oct  6 10:52 ..
-rw-r--r--  1 www-data www-data   418 Sep  2 22:33 index.php
-rw-r--r--  1 www-data www-data 19930 Sep  2 22:33 license.txt
-rw-r--r--  1 www-data www-data  7360 Sep 15 09:26 readme.html
-rw-r--r--  1 www-data www-data  4951 Sep  2 22:33 wp-activate.php
drwxr-xr-x  9 www-data www-data  4096 Sep 15 09:58 wp-admin
-rw-r--r--  1 www-data www-data   271 Sep  2 22:33 wp-blog-header.php
-rw-r--r--  1 www-data www-data  5007 Sep  2 22:33 wp-comments-post.php
-rw-r--r--  1 www-data www-data  2749 Oct  6 10:54 wp-config.php
-rw-r--r--  1 www-data www-data  2764 Sep  2 22:33 wp-config-sample.php
drwxr-xr-x  4 www-data www-data  4096 Sep 15 09:58 wp-content
-rw-r--r--  1 www-data www-data  3286 Sep  2 22:33 wp-cron.php
drwxr-xr-x 12 www-data www-data  4096 Sep 15 09:58 wp-includes
-rw-r--r--  1 www-data www-data  2380 Sep  2 22:33 wp-links-opml.php
-rw-r--r--  1 www-data www-data  3123 Sep  2 22:33 wp-load.php
-rw-r--r--  1 www-data www-data 34669 Sep  2 22:33 wp-login.php
-rw-r--r--  1 www-data www-data  8252 Sep  2 22:33 wp-mail.php
-rw-r--r--  1 www-data www-data 11062 Sep  2 22:33 wp-settings.php
-rw-r--r--  1 www-data www-data 25124 Sep  2 22:33 wp-signup.php
-rw-r--r--  1 www-data www-data  4035 Sep  2 22:33 wp-trackback.php
-rw-r--r--  1 www-data www-data  3055 Sep  2 22:33 xmlrpc.php
root@DMZ-Server:/var/www/wordpress# nano index.html

nginx scheint auf dem richtigen Port und allem zu laufen:

netstat -apn | grep 80
tcp        0      0 0.0.0.0:80    0.0.0.0:*    LISTEN      20612/nginx

Wenn ich die Site jedoch im lokalen Host besuche, wird in IRGENDEINEM der Protokolle (in wordpress-acess.log) nur dies angezeigt. Und der Fehler tritt nur MANCHMAL auf (was wirklich seltsam ist):

127.0.0.1 - - [06/Oct/2015:11:51:17 -0500] "GET / HTTP/1.1" 301 5 "-" "Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Firefox/38.0 Iceweasel/38.2.0"

Dann werde ich zwangsweise zu localhost:8090 umgeleitet. Ich bin mir immer noch nicht sicher, warum. Auch im php5-fpm-Protokoll wird nichts Ungewöhnliches angezeigt. Ich habe IPTables -nat -L überprüft, um zu sehen, ob etwas angezeigt wurde, aber es wurde nichts angezeigt. Irgendwelche Ideen?

Antwort1

Ich bitte um Entschuldigung, anscheinend hatte ich schon vor langer Zeit eine WordPress-Datenbank auf einem anderen Computer eingerichtet, sodass diese WordPress-Instanz die bereits konfigurierte Datenbank verwendete, in der die Portumleitung eingerichtet war. Nachdem ich die Datenbank bereinigt hatte, wurden die genauen Probleme behoben. (Ich kann WordPress immer noch nicht nur über http ausführen, es erzwingt aus irgendeinem Grund https, aber ich bin sicher, dass ich dieses Problem beheben kann).

verwandte Informationen