0

Not too experienced with web hosting, but I wanted to set up a wordpress site, but was having issues with an unexpected redirect, so I purged my entire nginx configuration, but still getting the redirect, not sure how, since I can't find any way it is redirecting!

Here is what I have:

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

Only one in my sites-enabled folder

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;

The wordpress folder is just the default 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 appears to be running on the correct port and everything:

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

Yet when I visit the site in localhost, this is all that shows in ANY of the logs (in the wordpress-acess.log). And this is only SOMETIMES that the error shows up (which is really odd):

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"

It then force redirects me to localhost:8090. I still am not sure why. Nothing unusual shows up in the php5-fpm log either. I checked IPTables -nat -L to see if anything showed up, but nothing did. Any ideas?

0

1 Answer 1

0

My apologies, apparently I already had a wordpress database setup from a long time ago from a different computer, so this wordpress instance was using the already configured database, which had the port redirection setup in the database. Once I purged the database that exact issues was fixed. (Still not able to run wordpress on just http, it forces https for some reason, but I'm sure I can fix that issue).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .