Learn about Centmin Mod LEMP Stack today
Become a Member

Xenforo Other sites redirect back to XF site after disk resize

Discussion in 'Forum software usage' started by CarpCharacin, Jun 7, 2017.

  1. CarpCharacin

    CarpCharacin Member

    265
    21
    18
    Oct 13, 2016
    Salt Lake City
    Ratings:
    +34
    Local Time:
    4:32 AM
    1.15.x
    MariaDB 10.1
    I added the listen directives so it looks like this:
    Code:
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    
    # redirect from non-www to www
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
    #server {
    #            listen   80;
    #            server_name xf2.utahfishkeepers.us;
    #            return 301 $scheme://www.xf2.utahfishkeepers.us$request_uri;
    #       }
    
    server {
        listen   80;
        listen [2600:3c01::f03c:91ff:fe2c:f69e]:80;
        listen   443;
        listen [2600:3c01::f03c:91ff:fe2c:f69e]:443;
    
        server_name xf2.utahfishkeepers.us www.xf2.utahfishkeepers.us;
    
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
      add_header X-Robots-Tag "noindex, nofollow";
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/xf2.utahfishkeepers.us/log/access.log combined buffer=256k flush=60m;
      error_log /home/nginx/domains/xf2.utahfishkeepers.us/log/error.log;
    
      root /home/nginx/domains/xf2.utahfishkeepers.us/public;
    
    location / {
         index index.php index.html index.htm;
         try_files $uri $uri/ /index.php?$uri&$args;
    }
    
    location /admin.php {
         #auth_basic "Private";
         #auth_basic_user_file /usr/local/nginx/conf/htpasswd_admin_php;
            include /usr/local/nginx/conf/php.conf;
            #allow 127.0.0.1;
            #allow YOURIPADDRESS;
            #deny all;
    }
    
    location /install/ {
         #auth_basic "Private";
         #auth_basic_user_file /usr/local/nginx/conf/htpasswd_admin_php;
            #include /usr/local/nginx/conf/php.conf;
            #allow 127.0.0.1;
            #allow YOURIPADDRESS;
            #deny all;
    }
    
    location /internal_data/ {
         internal;
         allow 127.0.0.1;
         #allow YOURIPADDRESS;
         deny all;
    }
    
    location /library/ {
         internal;
         allow 127.0.0.1;
         #allow YOURIPADDRESS;
         deny all;
    }
    
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/php.conf;
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    }
    flushed the dns cache on my computer, and now xf2.utahfishkeepers.us is no longer redirecting. Should I do the same for the carpcharacin.rocks vhost? It is still redirecting.
     
  2. eva2000

    eva2000 Administrator Staff Member

    44,750
    10,204
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,814
    Local Time:
    8:32 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Try n see
     
  3. CarpCharacin

    CarpCharacin Member

    265
    21
    18
    Oct 13, 2016
    Salt Lake City
    Ratings:
    +34
    Local Time:
    4:32 AM
    1.15.x
    MariaDB 10.1
    The carpcharacin.rocks ssl vhost has listen 443 ssl http2; as one of the listen directives. Should I still add listen 443;? Also, does it matter how many spaces there are before listen directives?
     
  4. CarpCharacin

    CarpCharacin Member

    265
    21
    18
    Oct 13, 2016
    Salt Lake City
    Ratings:
    +34
    Local Time:
    4:32 AM
    1.15.x
    MariaDB 10.1
    I tried adding the listen directives, so it looked like this:
    Code:
    #x# HTTPS-DEFAULT
     server {
    
       server_name carpcharacin.rocks www.carpcharacin.rocks;
       return 302 https://$server_name$request_uri;
       include /usr/local/nginx/conf/staticfiles.conf;
     }
    
    server {
      listen 443 ssl http2;
      listen   80;
      listen [2600:3c01::f03c:91ff:fe2c:f69e]:80;
      listen   443;
      listen [2600:3c01::f03c:91ff:fe2c:f69e]:443;
      server_name carpcharacin.rocks www.carpcharacin.rocks;
    
      include /usr/local/nginx/conf/ssl/carpcharacin.rocks/carpcharacin.rocks.crt.key.conf;
      include /usr/local/nginx/conf/ssl_include.conf;
    
      http2_max_field_size 16k;
      http2_max_header_size 32k;
      # mozilla recommended
      ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA256:EECDH+ECDSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+SHA384:EECDH+AES128:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!CAMELLIA;
      ssl_prefer_server_ciphers   on;
      #add_header Alternate-Protocol  443:npn-spdy/3;
    
      # before enabling HSTS line below read centminmod.com/nginx_domain_dns_setup.html#hsts
      #add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
      #spdy_headers_comp 5;
      ssl_buffer_size 1369;
      ssl_session_tickets on;
    
      # enable ocsp stapling
      resolver 8.8.8.8 8.8.4.4 valid=10m;
      resolver_timeout 10s;
      ssl_stapling on;
      ssl_stapling_verify on;
    
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/carpcharacin.rocks/log/access.log main_ext buffer=256k flush=60m;
      error_log /home/nginx/domains/carpcharacin.rocks/log/error.log;
    
      include /usr/local/nginx/conf/autoprotect/carpcharacin.rocks/autoprotect-carpcharacin.rocks.conf;
      root /home/nginx/domains/carpcharacin.rocks/public;
      # uncomment cloudflare.conf include if using cloudflare for
      # server and/or vhost site
      #include /usr/local/nginx/conf/cloudflare.conf;
      include /usr/local/nginx/conf/503include-main.conf;
    
      include /usr/local/nginx/conf/wpincludes/carpcharacin.rocks/wpcacheenabler_carpcharacin.rocks.conf;
      #include /usr/local/nginx/conf/wpincludes/carpcharacin.rocks/wpsupercache_carpcharacin.rocks.conf;
      # https://community.centminmod.com/posts/18828/
      #include /usr/local/nginx/conf/wpincludes/carpcharacin.rocks/rediscache_carpcharacin.rocks.conf;
    
      location / {
      include /usr/local/nginx/conf/503include-only.conf;
    
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # for wordpress super cache plugin
      #try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?q=$uri&$args;
    
      # for wp cache enabler plugin
      try_files $cache_enabler_uri $uri $uri/ $custom_subdir/index.php?$args;
    
      # Wordpress Permalinks
      #try_files $uri $uri/ /index.php?q=$uri&$args;
    
      # Nginx level redis Wordpress
      # https://community.centminmod.com/posts/18828/
      #try_files $uri $uri/ /index.php?$args;
    
      }
    
    location ~* /(wp-login\.php) {
        limit_req zone=xwplogin burst=1 nodelay;
        #limit_conn xwpconlimit 30;
        auth_basic "Private";
        #auth_basic_user_file /home/nginx/domains/carpcharacin.rocks/htpasswd_wplogin;
        include /usr/local/nginx/conf/php-wpsc.conf;
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
    location ~* /(xmlrpc\.php) {
        limit_req zone=xwprpc burst=45 nodelay;
        #limit_conn xwpconlimit 30;
        include /usr/local/nginx/conf/php-wpsc.conf;
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
      include /usr/local/nginx/conf/wpincludes/carpcharacin.rocks/wpsecure_carpcharacin.rocks.conf;
      include /usr/local/nginx/conf/php-wpsc.conf;
      # https://community.centminmod.com/posts/18828/
      #include /usr/local/nginx/conf/php-rediscache.conf;
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    }
    
    But when I tried to restart nginx and PHP, it said this:
    Code (Text):
    Restarting nginx (via systemctl):  Job for nginx.service failed because the cont       rol process exited with error code. See "systemctl status nginx.service" and "jo       urnalctl -xe" for details.
                                                               [FAILED]
    Gracefully shutting down php-fpm . done
    Starting php-fpm  done
    

    So I changed it back to looking like this:
    Code:
    #x# HTTPS-DEFAULT
     server {
    
       server_name carpcharacin.rocks www.carpcharacin.rocks;
       return 302 https://$server_name$request_uri;
       include /usr/local/nginx/conf/staticfiles.conf;
     }
    
    server {
      listen 443 ssl http2;
      server_name carpcharacin.rocks www.carpcharacin.rocks;
    
      include /usr/local/nginx/conf/ssl/carpcharacin.rocks/carpcharacin.rocks.crt.key.conf;
      include /usr/local/nginx/conf/ssl_include.conf;
    
      http2_max_field_size 16k;
      http2_max_header_size 32k;
      # mozilla recommended
      ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA256:EECDH+ECDSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+SHA384:EECDH+AES128:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!CAMELLIA;
      ssl_prefer_server_ciphers   on;
      #add_header Alternate-Protocol  443:npn-spdy/3;
    
      # before enabling HSTS line below read centminmod.com/nginx_domain_dns_setup.html#hsts
      #add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
      #spdy_headers_comp 5;
      ssl_buffer_size 1369;
      ssl_session_tickets on;
    
      # enable ocsp stapling
      resolver 8.8.8.8 8.8.4.4 valid=10m;
      resolver_timeout 10s;
      ssl_stapling on;
      ssl_stapling_verify on;
    
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/carpcharacin.rocks/log/access.log main_ext buffer=256k flush=60m;
      error_log /home/nginx/domains/carpcharacin.rocks/log/error.log;
    
      include /usr/local/nginx/conf/autoprotect/carpcharacin.rocks/autoprotect-carpcharacin.rocks.conf;
      root /home/nginx/domains/carpcharacin.rocks/public;
      # uncomment cloudflare.conf include if using cloudflare for
      # server and/or vhost site
      #include /usr/local/nginx/conf/cloudflare.conf;
      include /usr/local/nginx/conf/503include-main.conf;
    
      include /usr/local/nginx/conf/wpincludes/carpcharacin.rocks/wpcacheenabler_carpcharacin.rocks.conf;
      #include /usr/local/nginx/conf/wpincludes/carpcharacin.rocks/wpsupercache_carpcharacin.rocks.conf;
      # https://community.centminmod.com/posts/18828/
      #include /usr/local/nginx/conf/wpincludes/carpcharacin.rocks/rediscache_carpcharacin.rocks.conf;
    
      location / {
      include /usr/local/nginx/conf/503include-only.conf;
    
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # for wordpress super cache plugin
      #try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?q=$uri&$args;
    
      # for wp cache enabler plugin
      try_files $cache_enabler_uri $uri $uri/ $custom_subdir/index.php?$args;
    
      # Wordpress Permalinks
      #try_files $uri $uri/ /index.php?q=$uri&$args;
    
      # Nginx level redis Wordpress
      # https://community.centminmod.com/posts/18828/
      #try_files $uri $uri/ /index.php?$args;
    
      }
    
    location ~* /(wp-login\.php) {
        limit_req zone=xwplogin burst=1 nodelay;
        #limit_conn xwpconlimit 30;
        auth_basic "Private";
        #auth_basic_user_file /home/nginx/domains/carpcharacin.rocks/htpasswd_wplogin;
        include /usr/local/nginx/conf/php-wpsc.conf;
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
    location ~* /(xmlrpc\.php) {
        limit_req zone=xwprpc burst=45 nodelay;
        #limit_conn xwpconlimit 30;
        include /usr/local/nginx/conf/php-wpsc.conf;
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
      include /usr/local/nginx/conf/wpincludes/carpcharacin.rocks/wpsecure_carpcharacin.rocks.conf;
      include /usr/local/nginx/conf/php-wpsc.conf;
      # https://community.centminmod.com/posts/18828/
      #include /usr/local/nginx/conf/php-rediscache.conf;
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    }
    
    and nginx restarted successfully. What should I change it to?
     
  5. eva2000

    eva2000 Administrator Staff Member

    44,750
    10,204
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,814
    Local Time:
    8:32 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    duplicate listen directives
    Code (Text):
      listen 443 ssl http2;
      listen   80;
      listen [2600:3c01::f03c:91ff:fe2c:f69e]:80;
      listen   443;
      listen [2600:3c01::f03c:91ff:fe2c:f69e]:443;
    

    should be just for https 443
    Code (Text):
      listen 443 ssl http2;
      listen [2600:3c01::f03c:91ff:fe2c:f69e]:443 ssl http2;
    
     
  6. eva2000

    eva2000 Administrator Staff Member

    44,750
    10,204
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,814
    Local Time:
    8:32 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    noticed same mistake in Xenforo - Other sites redirect back to XF site after disk resize
    Code (Text):
    server {
       listen   443 ssl http2;
       listen [2600:3c01::f03c:91ff:fe2c:f69e]:80;
       listen [2600:3c01::f03c:91ff:fe2c:f69e]:443 ssl http2;
       server_name www.utahfishkeepers.us;
    

    should be
    Code (Text):
    server {
       listen   443 ssl http2;
       listen [2600:3c01::f03c:91ff:fe2c:f69e]:443 ssl http2;
       server_name www.utahfishkeepers.us;
    
     
  7. CarpCharacin

    CarpCharacin Member

    265
    21
    18
    Oct 13, 2016
    Salt Lake City
    Ratings:
    +34
    Local Time:
    4:32 AM
    1.15.x
    MariaDB 10.1
    I made those changes and flushed my dns resolver cache, but carpcharacin.rocks is still redirecting to www.utahfishkeepers.us, but xf2.utahfishkeepers.us isn't.
     
  8. CarpCharacin

    CarpCharacin Member

    265
    21
    18
    Oct 13, 2016
    Salt Lake City
    Ratings:
    +34
    Local Time:
    4:32 AM
    1.15.x
    MariaDB 10.1
    The site is working now, but the let's encrypt certificate is expired. How do I fix that?
     
  9. eva2000

    eva2000 Administrator Staff Member

    44,750
    10,204
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,814
    Local Time:
    8:32 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Start a new thread ;) It should of auto renewed by acme.sh cronjob - what's output for
    Code (Text):
    grep acme /var/log/cron* | sed -e "s|$(hostname -s)|host|g"
    

    Code (Text):
    echo y | /usr/local/src/centminmod/addons/acmetool.sh checkdates 
    

    Code (Text):
    "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh"