Learn about Centmin Mod LEMP Stack today
Become a Member

Xenforo APC or Memcache

Discussion in 'Forum software usage' started by KeVo, Jun 30, 2014.

  1. eva2000

    eva2000 Administrator Staff Member

    54,884
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    2:58 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    check your /usr/local/nginx/conf/include_opcache.conf to see if the location matches the same xx_opcache.php as one in /usr/local/nginx/html


    Code:
    location ~ ^/(${N}_opcache.php) {
        include /usr/local/nginx/conf/php.conf;
        auth_basic "Password Protected";
        auth_basic_user_file /usr/local/nginx/conf/htpasswd_opcache;
                }
    it's still related to the bug .08 beta03 i think, just haven't found where the problem is as to why it isn't created on initial install just tested fresh install seems this change 8 days ago fixed opcache.php password protection update inc/zendopcache_install.inc · centminmod/centminmod@faae194 · GitHub as it works for me now.

    what do you have in contents of /usr/local/nginx/conf/conf.d/virtual.conf ? wrap in CODE tags - you just need to match /usr/local/nginx/conf/include_opcache.conf listed xx_opcache.php filename to one at /usr/local/nginx/html/xx_opcache.php then restart nginx and php-fpm
     
    Last edited: Jul 7, 2015
  2. quicksalad

    quicksalad Member

    228
    13
    18
    May 31, 2015
    Ratings:
    +20
    Local Time:
    10:28 PM
    Code:
    server {
    #         listen   80;
                listen   80 default_server backlog=2048;
                server_name hostname.mysite.com;
                root html;
    
            access_log              /var/log/nginx/localhost.access.log     main buffer=32k;
            error_log               /var/log/nginx/localhost.error.log      error;
    
    # 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;
    
    # limit_conn limit_per_ip 16;
    # ssi  on;
    
                location / {
    
    # block common exploits, sql injections etc
    #include /usr/local/nginx/conf/block.conf;
    
    #         Enables directory listings when index file not found
    #        autoindex  on;
    
    #        Shows file listing times as local time
    #        autoindex_localtime on;
    
    #        Enable for vBulletin usage WITHOUT vbSEO installed
    #        try_files        $uri $uri/ /index.php;
              
                }
    
            # example nginx-http-concat
            # /csstest/??one.css,two.css
            #location /csstest {
            #concat on;
            #concat_max_files 20;
            #}
    
    include /usr/local/nginx/conf/phpmyadmin.conf;
    include /usr/local/nginx/conf/staticfiles.conf;
    include /usr/local/nginx/conf/php.conf;
    #include /usr/local/nginx/conf/phpstatus.conf;
    include /usr/local/nginx/conf/drop.conf;
    #include /usr/local/nginx/conf/errorpage.conf;
    
           }
    
    see above code for reference. Any issue with my config above?
    I couldn't locate this file /usr/local/nginx/conf/include_opcache.conf

    BTW, I using .07 stable.
     
  3. eva2000

    eva2000 Administrator Staff Member

    54,884
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    2:58 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    seems your old install had the bug so it wasn't created

    should have between staticfiles.conf and php.conf includes
    Code:
    include /usr/local/nginx/conf/staticfiles.conf;
    include /usr/local/nginx/conf/include_opcache.conf;
    include /usr/local/nginx/conf/php.conf;
    so do the following:

    update your install to latest .08 beta 03 code via centmin.sh menu option 23 and sub menus 1 and 2 Beta Branch - New .08 beta menu option - updating Centmin Mod via git | Centmin Mod Community

    then delete /usr/local/nginx/html/xx_opcache.php and try centmin.sh menu option 12 submenu to Install zend opcache again
     
  4. quicksalad

    quicksalad Member

    228
    13
    18
    May 31, 2015
    Ratings:
    +20
    Local Time:
    10:28 PM
    ooops I only have 22 options... wait... :)
     
  5. quicksalad

    quicksalad Member

    228
    13
    18
    May 31, 2015
    Ratings:
    +20
    Local Time:
    10:28 PM
    run option 12 again but still no password prompted :(

    created files:
    /usr/local/nginx/conf/htpasswd_opcache
    vhost added this line
    include /usr/local/nginx/conf/include_opcache.conf;
     
    Last edited: Jul 7, 2015
  6. eva2000

    eva2000 Administrator Staff Member

    54,884
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    2:58 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    older version .. need to update to latest .08 beta03 ;)
    did you update .08 beta 03 first ? did you restart nginx and php-fpm after running option 12 ? clear browser cache and restart browser too
     
  7. quicksalad

    quicksalad Member

    228
    13
    18
    May 31, 2015
    Ratings:
    +20
    Local Time:
    10:28 PM
    yes I already restarted nginx and php-fpm, cleared browser cache and other data but still it doesn't prompt a password.
     
  8. eva2000

    eva2000 Administrator Staff Member

    54,884
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    2:58 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    what's contents of /usr/local/nginx/conf/htpasswd_opcache ?

    you can re-create the user and password using these 4 commands in SSH manually and then restart nginx and php-fpm (nprestart cmd shortcut does that)

    Code:
    OPSALT=$(openssl rand 3 -base64)
    OPUSER=$(echo "opadmin${CSALT}")
    OPPASS=$(openssl rand 16 -base64)
    /usr/local/nginx/conf/htpasswd.sh create /usr/local/nginx/conf/htpasswd_opcache $OPUSER $OPPASS
    nprestart
    to see what the generated username and password are type right after above cmds

    Code:
    echo $OPUSER
    echo $OPPASS
     
    Last edited: Jul 8, 2015
  9. quicksalad

    quicksalad Member

    228
    13
    18
    May 31, 2015
    Ratings:
    +20
    Local Time:
    10:28 PM
    opadmin:$randomchars.

    I'll try above suggestions and let you know. Thanks
     
  10. eva2000

    eva2000 Administrator Staff Member

    54,884
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    2:58 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    oh and the include for
    Code:
    include /usr/local/nginx/conf/include_opcache.conf;
    goes in /usr/local/nginx/conf/conf.d/virtual.conf vhost not your site vhost file
     
  11. quicksalad

    quicksalad Member

    228
    13
    18
    May 31, 2015
    Ratings:
    +20
    Local Time:
    10:28 PM
    here's the line on my vhost
    location: /usr/local/nginx/conf/conf.d/virtual.conf

    Code:
      # example nginx-http-concat
            # /csstest/??one.css,two.css
            #location /csstest {
            #concat on;
            #concat_max_files 20;
            #}
    
    include /usr/local/nginx/conf/phpmyadmin.conf;
    include /usr/local/nginx/conf/staticfiles.conf;
    include /usr/local/nginx/conf/include_opcache.conf;
    include /usr/local/nginx/conf/php.conf;
    #include /usr/local/nginx/conf/phpstatus.conf;
    include /usr/local/nginx/conf/drop.conf;
    #include /usr/local/nginx/conf/errorpage.conf;
     
  12. eva2000

    eva2000 Administrator Staff Member

    54,884
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    2:58 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    looks right to me :)
     
  13. quicksalad

    quicksalad Member

    228
    13
    18
    May 31, 2015
    Ratings:
    +20
    Local Time:
    10:28 PM
    why is that it doesn't prompt a password? I think config is right but include /usr/local/nginx/conf/include_opcache.conf; is not calling what is declared on that file :(

    here' my include_opcache.conf
    Code:
                location ~ ^/(random#_opcache.php) {
        include /usr/local/nginx/conf/php.conf;
        auth_basic "Password Protected";
        auth_basic_user_file /usr/local/nginx/conf/htpasswd_opcache;
                }
     
    Last edited: Jul 8, 2015
  14. eva2000

    eva2000 Administrator Staff Member

    54,884
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    2:58 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    make sure in /usr/local/nginx/conf/include_opcache.conf that location matches the same xx_opcache.php file you have in /usr/local/nginx/html/xx_opcache.php

    i.e. /usr/local/nginx/conf/include_opcache.conf
    Code:
                location ~ ^/(4eeaf5bc_opcache.php) {
        include /usr/local/nginx/conf/php.conf;
            auth_basic "Password Protected";
            auth_basic_user_file /usr/local/nginx/conf/htpasswd_opcache;
                }
    also test in SSH using curl

    Code:
    curl -I localhost/xx_opcache.php
    curl -I yourmainhostnam.com/xx_opcache.php
    
    should return permission denied or 401 unauthorised

    Code:
    curl -I localhost/4eeaf5bc_opcache.php      
    HTTP/1.1 401 Unauthorized
    Date: Wed, 08 Jul 2015 05:12:49 GMT
    Content-Type: text/html; charset=utf-8
    Content-Length: 188
    Connection: keep-alive
    WWW-Authenticate: Basic realm="Password Protected"
    Server: nginx centminmod
    if the curl comes back correct but browser isn't prompting, then you browser cache needs clearing
     
  15. quicksalad

    quicksalad Member

    228
    13
    18
    May 31, 2015
    Ratings:
    +20
    Local Time:
    10:28 PM
    curl -I localhost/random_opcache.php

    returns

    Code:
    HTTP/1.1 401 Unauthorized
    Server: nginx centminmod
    Date: Wed, 08 Jul 2015 05:18:17 GMT
    Content-Type: text/html; charset=utf-8
    Content-Length: 188
    Connection: keep-alive
    WWW-Authenticate: Basic realm="Password Protected"
     
  16. quicksalad

    quicksalad Member

    228
    13
    18
    May 31, 2015
    Ratings:
    +20
    Local Time:
    10:28 PM
    found out that accessing opcache stats via https doesn't prompt a password? why is that?
     
  17. eva2000

    eva2000 Administrator Staff Member

    54,884
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    2:58 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    if you setup mainhostname.com on https too, then include line for /usr/local/nginx/conf/include_opcache.conf needs to be in the https version of mainhostname.com vhost conf file too if it's seperate from virtual.conf file
     
  18. quicksalad

    quicksalad Member

    228
    13
    18
    May 31, 2015
    Ratings:
    +20
    Local Time:
    10:28 PM
    any link how to do that? Thanks
     
  19. eva2000

    eva2000 Administrator Staff Member

    54,884
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    2:58 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    same as what you did in post 23 on this thread Xenforo - APC or Memcache | Page 2 | Centmin Mod Community add include file to the ssl version of main hostname server context that you setup for SSL - if you didn't set one up for SSL, you wouldn't of been able to access https version of mainhostname.com
     
  20. quicksalad

    quicksalad Member

    228
    13
    18
    May 31, 2015
    Ratings:
    +20
    Local Time:
    10:28 PM
    I don't remember that I setup https version of my mainhostname but I can access following using https://IPaddress

    1.phpMyAdmin page w/ authentication
    2.Memcache page w/ authentication