Nginx 및 php5-fpm에서 예기치 않은 리디렉션

Nginx 및 php5-fpm에서 예기치 않은 리디렉션

웹 호스팅 경험이 많지 않았지만 WordPress 사이트를 설정하고 싶었지만 예상치 못한 리디렉션 문제가 있어서 전체 nginx 구성을 제거했지만 여전히 리디렉션을 받고 있습니다. 찾을 수 없기 때문에 방법을 모르겠습니다. 어쨌든 리디렉션 중입니다!

내가 가진 것은 다음과 같습니다.

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/*;
}

내 사이트 사용 폴더에 하나만 있음

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;

wordpress 폴더는 기본 다운로드입니다.

/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가 올바른 포트와 모든 항목에서 실행되고 있는 것 같습니다.

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

그러나 내가 localhost의 사이트를 방문하면 이것이 모든 로그(wordpress-acess.log)에 표시되는 전부입니다. 그리고 이것은 때때로 오류가 나타나는 경우입니다(정말 이상합니다).

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"

그런 다음 강제로 localhost:8090으로 리디렉션됩니다. 나는 아직도 왜 그런지 잘 모르겠습니다. php5-fpm 로그에도 특이한 내용은 나타나지 않습니다. IPTables -nat -L을 확인하여 아무것도 나타나지 않았는지 확인했지만 아무 것도 나타나지 않았습니다. 어떤 아이디어가 있나요?

답변1

죄송합니다. 저는 이미 오래 전에 다른 컴퓨터에서 WordPress 데이터베이스를 설정해 놓았기 때문에 이 WordPress 인스턴스는 데이터베이스에 포트 리디렉션이 설정된 이미 구성된 데이터베이스를 사용하고 있었습니다. 데이터베이스를 삭제한 후 정확한 문제가 해결되었습니다. (여전히 http에서만 wordpress를 실행할 수 없으며 어떤 이유로든 https를 강제로 실행하지만 해당 문제를 해결할 수 있다고 확신합니다.)

관련 정보