Join the community today
Become a Member

Xenforo My Xenforo Nginx vhost configuration

Discussion in 'Forum software usage' started by eva2000, May 30, 2014.

  1. eva2000

    eva2000 Administrator Staff Member

    44,750
    10,204
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,814
    Local Time:
    8:44 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Nginx rewrites etc ain't my strong suit so I use what works for me so if you have better alternatives, I'm all ears and eyes :D

    The php.conf included otherwise PHP files end up with 404 not found errors. As to access from install, only css file seems accessible for me.

    Code:
    curl -I forumurl/install/                
    HTTP/1.1 403 Forbidden
    Server: nginx centminmod
    Date: Thu, 26 Feb 2015 03:40:27 GMT
    Content-Type: text/html; charset=utf-8
    Connection: keep-alive
    Vary: Accept-Encoding
    
    Code:
    curl -I forumurl/install/index.php?upgrade/
    HTTP/1.1 403 Forbidden
    Server: nginx centminmod
    Date: Thu, 26 Feb 2015 03:40:36 GMT
    Content-Type: text/html; charset=utf-8
    Connection: keep-alive
    Vary: Accept-Encoding
    
    Code:
    curl -I forumurl/install/data/options.xml
    HTTP/1.1 403 Forbidden
    Server: nginx centminmod
    Date: Thu, 26 Feb 2015 03:43:17 GMT
    Content-Type: text/html; charset=utf-8
    Connection: keep-alive
    Vary: Accept-Encoding
    
    Code:
    curl -I forumurl/install/install.css  
    HTTP/1.1 200 OK
    Server: nginx centminmod
    Date: Thu, 26 Feb 2015 03:44:19 GMT
    Content-Type: text/css
    Content-Length: 15092
    Last-Modified: Tue, 12 Aug 2014 16:45:30 GMT
    Connection: keep-alive
    Vary: Accept-Encoding
    ETag: "53ea44aa-3af4"
    Expires: Sat, 28 Mar 2015 03:44:19 GMT
    Cache-Control: max-age=2592000
    Cache-Control: public, must-revalidate, proxy-revalidate
    Accept-Ranges: bytes
    
    But I welcome any better suggestions :)

    edit: just checked my conf and i am using

    Code:
      location /admin.php {
            include /usr/local/nginx/conf/php.conf;
            allow 127.0.0.1;
            allow myipaddress;
            deny all;
    }
     
    Last edited: Feb 26, 2015
  2. rdan

    rdan Well-Known Member

    4,962
    1,183
    113
    May 25, 2014
    Ratings:
    +1,797
    Local Time:
    6:44 PM
    Mainline
    10.2
    I'm using:
    Code:
    location ~ ^/(admin.php) {
       
            }
     
  3. jeffwidman

    jeffwidman Active Member

    152
    27
    28
    Dec 3, 2014
    Ratings:
    +51
    Local Time:
    3:44 AM
    Yeah me too. Not sure why the 404's show up.

    Only quick change here is you can drop the "index index.php..." line from the install location block--it will get inherited from the parent server or location block depending on whether you run the forum at the root or in a subfolder. One of the common issues mentioned here: Pitfalls - Nginx Community

    I just tested, and works fine without it for me.
     
  4. jeffwidman

    jeffwidman Active Member

    152
    27
    28
    Dec 3, 2014
    Ratings:
    +51
    Local Time:
    3:44 AM
    Hey eva2000--I'm monkeying around in Nginx conf files and noticed a couple of possible tweaks to what you've got here:

    1) You've got community.centminmod.com:80 and www.c.c.c:80 redirecting to their port 443 equivalents. So theoretically, you're serving duplicate content on with/without the www subdomain. Google used to penalize you for duplicate content on this, but these days they make an exception for the www prefix.
    But best practice is normally to pick one of the 4 permutations of port 80/443 and with/without www, and then 301 the other three variants to it. For a subdomain like this, I'd probably strip the www prefix.

    2) you explicitly included directives regarding the www prefix, but when I go to https://www.community.centminmod.com/ I get no response. I'm not sure if that's an Nginx issue or an SSL cert issue--I haven't worked much with https.

    Anyway, thought you'd want to know. Most of Nginx is relatively straightforward, but there certainly are some non-intuitive quirks, ala what I hit here that across all vhost domains, you can only manually specify the 'ipv6only' variable once per port. Specifying it for the same port on multiple domains causes errors: Nginx not responding to IPv4 when Listen directive updated to support IPv6 · Issue #36 · centminmod/centminmod · GitHub
     
    Last edited: Apr 24, 2015
  5. eva2000

    eva2000 Administrator Staff Member

    44,750
    10,204
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,814
    Local Time:
    8:44 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    yeah i removed www. from ssl spdy server context already :)

    yup already a known fact :)
     
  6. Andy

    Andy Active Member

    461
    73
    28
    Aug 6, 2014
    Ratings:
    +102
    Local Time:
    6:44 AM
    Any update on conf file for Xenforo 2 beta 1? Would there be any change?
    I would like to use it on /forum/ dir or on root directory.
     
  7. eva2000

    eva2000 Administrator Staff Member

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