• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Centminmod help

Andy.N

Well-known member
#1
I recently got a new server and start playing with centminmod. I download and install the latest version, add a vhost, upload the XF files from my production server to the /public/ but going to the IP address of this new server always shows the nginx test page.
Here is the
Code:
server {
  server_name quantnet.com www.quantnet.com;

  listen 80;

# 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;

  access_log /home/nginx/domains/quantnet.com/log/access.log combined buffer=32k;
  error_log /home/nginx/domains/quantnet.com/log/error.log;

  root /home/nginx/domains/quantnet.com/public;

location / {
            index index.php index.html index.htm;
            try_files $uri $uri/ /index.php?$uri&$args;

        }

        location //internal_data/ {
        internal;
        allow 127.0.0.1;
        deny all;
        }
    
      
    location /library/ {
        internal;
        allow 127.0.0.1;
        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;
}
Thanks for any help.
 

p4guru

Well-known member
#2
Could be the default server Nginx vhost which points to server ip address in play

edit default vhost for server via command line in SSH telnet type:

Code:
vhostconf
that will call nano text editor for file at /usr/local/nginx/conf/conf.d/virtual.conf (the default server's Nginx vhost) different from your domain's vhost file created via menu option #2 ( i.e. /usr/local/nginx/conf/conf.d/yourdomain.com.conf)

or edit file directly via vi or pico for /usr/local/nginx/conf/conf.d/virtual.conf

and change server_name from localhost to the server's main hostname used to setup the server i.e. when you order a server you enter a hostname.domain.com

Code:
server {
#        listen  80;
            listen  80 default_server;
            server_name localhost;
then hit CTRL+X and y (yes) to save and exit nano text editor

then restart nginx server either via

Code:
service nginx restart
or command line short cut

Code:
ngxrestart
Also make sure your domain's DNS pointing to server's correct IP address for A record

ps. your config has extra forward slash in it for

Code:
location //
 
Last edited:

Andy.N

Well-known member
#3
@p4guru
Thank you very much.
I'm surprised that there is nothing on the centmin website telling me to edit the virtual.conf file.
I'm still unclear of what you tell me that I need to do. Do I need to modify the virtual.conf file to be like that of the newdomain.com.conf

Because if I do, it will give me a warning when I restart about a conflicting server name.

Also, I'm using this to test the new server before pointing the domain DNS to the new server IP. How do I test it before going live?
 

p4guru

Well-known member
#4
@p4guru
Thank you very much.
I'm surprised that there is nothing on the centmin website telling me to edit the virtual.conf file.
I'm still unclear of what you tell me that I need to do. Do I need to modify the virtual.conf file to be like that of the newdomain.com.conf

Because if I do, it will give me a warning when I restart about a conflicting server name.
no not entire replication of your newdomain.com.conf, just in virtual.conf one entry needs changing localhost to your hostname.domain.com

i.e. you buy a new server and entered host1.domain.com as hostname, that is the default host name for server which when DNS is updated would mean visiting host1.domain.com will go to server's main IP address. Then setup via menu option #2 your domain.com vhost and that would be at domain.com.conf vhost for your domain.

When dns is updated, visiting
  1. host1.domain.com goes to main IP of server controlled via vhost at virtual.conf
  2. domain.com goes to main IP of server controlled via vhost domain.com.conf
Also, I'm using this to test the new server before pointing the domain DNS to the new server IP. How do I test it before going live?
oh in that case, then everything is normal, as your domain DNS hasn't been updated so yes, if you visit main ip address of your server you will get default nginx setup page. Same happens for apache web servers if you access main server IP address goes to apache default setup page :)

if you want to preview before dns update, need to edit your own windows pc's local hosts file at C:\Windows\System32\drivers\etc\hosts with entry

ipaddress domain.com

i.e.

Code:
111.222.333.444 domain.com
save hosts file and then flushdns within windows and browser cache clear

Code:
ipconfig /flushdns
from windows DOS command line.

Then visit domain.com which should point to 111.222.333.444 or whatever your server's IP address

Then after doing that update domain DNS and remove hosts entry from windows pc.
 

Andy.N

Well-known member
#6
no not entire replication of your newdomain.com.conf, just in virtual.conf one entry needs changing localhost to your hostname.domain.com

i.e. you buy a new server and entered host1.domain.com as hostname, that is the default host name for server which when DNS is updated would mean visiting host1.domain.com will go to server's main IP address. Then setup via menu option #2 your domain.com vhost and that would be at domain.com.conf vhost for your domain.

When dns is updated, visiting
  1. host1.domain.com goes to main IP of server controlled via vhost at virtual.conf
  2. domain.com goes to main IP of server controlled via vhost domain.com.conf
I already change the host file so that locally I can bypass the DNS.
This centminmod thing is a lot tricky than I was led to believe.

I only have one domain so trying to understand as best what you said.
My virtual.conf
PHP:
server {
            listen   80 default_server;
            server_name ns1.quantnet.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 / {

#               Enables directory listings when index file not found
                autoindex  on;

            }

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;

       }
My domain.com.conf
PHP:
server {
  server_name quantnet.com www.quantnet.com;

  listen 80;

# 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;

  access_log /home/nginx/domains/quantnet.com/log/access.log combined buffer=32k;
  error_log /home/nginx/domains/quantnet.com/log/error.log;

  root /home/nginx/domains/quantnet.com/public;

location / {
            index index.php index.html index.htm;
            try_files $uri $uri/ /index.php?$uri&$args;

        }

        location /internal_data/ {
        internal;
        allow 127.0.0.1;
        deny all;
        }

    
 location /library/ {
        internal;
        allow 127.0.0.1;
        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;
}
1) Doing a ngxrestart will only check the virtual.conf and it does not seem to do anything with the domain.com.conf
2) Going directly to the new server IP will show the nginx test page
3) going to quantnet.com (now using the local host file change) will have a blank page
4) Pagespeed console is empty.
 

p4guru

Well-known member
#7
1) Doing a ngxrestart will only check the virtual.conf and it does not seem to do anything with the domain.com.conf
2) Going directly to the new server IP will show the nginx test page
3) going to quantnet.com (now using the local host file change) will have a blank page
4) Pagespeed console is empty.
Shouldn't be tricky at all, setup over 80+ servers with centmin mod easily :) Your live site seems to be Nginx based too, so the basics are pretty similar just vhost config format differs.

Going to main server IP is meant to go to nginx test page that is normal. Going to quantnet.com should go to the XF site. Maybe confirm by calling a known working static file first i.e. forum logo or image while host file edit is in place.

Might want to check your access and error log /home/nginx/domains/quantnet.com/log/error.log for any clues.

But i checked your live site https://www.quantnet.com/forum/ and you're behind https ? same for the copy data you uploaded ? could be problem with SSL/https ? You'd have to setup https/SSL for centmin mod as well then https://plus.google.com/100142147573491326940/posts/9d9qgv5cwLA. Might want to check out Centmin Mod G+ Community site then and ask for help
 

Andy.N

Well-known member
#8
@p4guru
I copy the whole directory of my live site and move them under the public/ directory on the new server
You can access a file directly at
http://192.237.163.162/robots.txt

What I did differently is to change the root in the virtual.conf file is to point to the new domain public dir
Code:
server {
            listen   80 default_server;
            server_name ns1.quantnet.com;
            root /home/nginx/domains/quantnet.com/public;
            #root   html;
Might want to check your access and error log /home/nginx/domains/quantnet.com/log/error.log for any clues.
2013/07/24 13:07:23 [error] 3513#0: *3 FastCGI sent in stderr: "PHP message: PHP Warning: require(/home/nginx/domains/quantnet.com/public/library/XenForo/Autoloader.php): failed to open stream: Permission denied in /home/nginx/domains/quantnet.com/public/index.php on line 6
PHP message: PHP Fatal error: require(): Failed opening required '/home/nginx/domains/quantnet.com/public/library/XenForo/Autoloader.php' (include_path='.:/usr/local/lib/php') in /home/nginx/domains/quantnet.com/public/index.php on line 6" while reading response header from upstream, client: 209.150.45.88, server: quantnet.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "quantnet.com"
 

p4guru

Well-known member
#9
But did your live backup have forum url set to https:// or http:// as when you restore the db would have whatever your live forum had set i.e. https which wouldn't work unless you setup SSL/https vhost for domain on new Centmin Mod server.

What happens when you remove these 2 lines from location /library

Code:
      allow 127.0.0.1;
      deny all;
and restart nginx.

also make sure files are owned by nginx so

Code:
chown -R nginx:nginx /home/nginx/domains/quantnet.com/public
reverse the changes from virtual.conf back to just changing localhost to your hostname.domain.com and only edit your domain.com again

maybe easier just to see all your domains.conf vhost files and see what the problem is ?

if you can this command, should output them all and then you can mask any info you want before posting/sharing it here

Code:
for c in $(find /usr/local/nginx/conf/conf.d/ -type f -print | grep -v ssl.conf); do echo "contents of $c"; echo; cat $c; echo; done
Also for now at least disable ngx_pagespeed until you get things working, so in SSH type

Code:
pscontrol off
to globally disable ngx_pagespeed first
 
Last edited:

Andy.N

Well-known member
#10
I did everything you asked. There are no new errors in the log.
Going to both ip and quantnet.com gets me the nginx test page.
I can access the static files behind /public/ if i'm using the ip instead of domain name.

Please note that I do not install step 3 (setting up NSD) since the DNS is hosted by my registrar
http://centminmod.com/nginx_domain_dns_setup.html


if you can this command, should output them all and then you can mask any info you want before posting/sharing it here

Code:
for c in $(find /usr/local/nginx/conf/conf.d/ -type f -print | grep -v ssl.conf); do echo "contents of $c"; echo; cat $c; echo; done
result is
Code:
contents of /usr/local/nginx/conf/conf.d/quantnet.com.conf

#Permanently redirect all org/net/info domains to com
server {
    server_name  .quantnet.org .quantnet.net .quantnet.info;
    rewrite ^(.*) https://www.quantnet.com$1 permanent;
}

server {
        listen 443 ssl spdy;
            server_name quantnet.com;

        ssl_certificate      /xxxx/quantnet_combined.crt;
        ssl_certificate_key  /xxxx/quantnet.key;
        ssl_protocols             SSLv3 TLSv1.1 TLSv1.2;
        ssl_session_cache      shared:SSL:10m;
        ssl_session_timeout  1m;
        ssl_ciphers ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH;
        ssl_prefer_server_ciphers   on;
        add_header Alternate-Protocol  443:npn-spdy/2;



# 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;

  access_log /home/nginx/domains/quantnet.com/log/access.log combined buffer=32k;
  error_log /home/nginx/domains/quantnet.com/log/error.log;

  root /home/nginx/domains/quantnet.com/public;

location / {
            index index.php index.html index.htm;
            try_files $uri $uri/ /index.php?$uri&$args;

        }

        location /internal_data/ {
        internal;
        }

        location /library/ {
        internal;
        }

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

contents of /usr/local/nginx/conf/conf.d/virtual.conf

server {
            listen   80 default_server;
            server_name ns1.quantnet.com;
#            root /home/nginx/domains/quantnet.com/public;
            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 / {

#               Enables directory listings when index file not found
                autoindex  on;

            }

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;

       }
 

p4guru

Well-known member
#11
Ah i think i see your problem it's the portal you have on index page causing problems. So those 2 configs work.

When using host file edit at C:\Windows\System32\drivers\etc\hosts i can visit the forum url fine https://www.quantnet.com/forum/ and points to ip 192.237.163.162 fine.

i'm using

Code:
192.237.163.162 quantnet.com www.quantnet.com
Don't use portal so can't help with that.. did you have additional rewrite rules on live forums added for that to do work ?

edit: okay bit more looking and it could be www. versus non-www. config

try this instead

Code:
#Permanently redirect all org/net/info domains to com
server {
    server_name  .quantnet.com .quantnet.org .quantnet.net .quantnet.info;
    rewrite ^(.*) https://www.quantnet.com$1 permanent;
}

server {
        listen 443 ssl spdy;
            server_name www.quantnet.com;
or

Code:
#Permanently redirect all org/net/info domains to com
server {
    server_name  .quantnet.com .quantnet.org .quantnet.net .quantnet.info;
    rewrite ^ https://www.quantnet.com$request_uri? permanent;
}

server {
        listen 443 ssl spdy;
            server_name www.quantnet.com;
or

Code:
#Permanently redirect all org/net/info domains to com
server {
    server_name  .quantnet.com .quantnet.org .quantnet.net .quantnet.info;
    rewrite ^ https://$server_name$request_uri? permanent;
}

server {
        listen 443 ssl spdy;
            server_name www.quantnet.com;
first server {} missing quantnet.com entry so when non-www domain is accessed it hits main ip virtual.conf. Then you have redirect which goes to non-www in SSL server {}

Basically it's a Nginx vhost misconfiguration with https/SSL complications probably as it wasn't setup initially.
 
Last edited:

Andy.N

Well-known member
#12
@p4guru Can you try again?
pscontrol on
and the nginx conf I'm having right now is
Code:
#Permanently redirect all org/net/info domains to com
server {
    server_name  .quantnet.com .quantnet.us .quantnet.org .quantnet.net .quantnet.info;
    rewrite ^ https://www.quantnet.com$1 permanent;
}

server {
        listen 443 ssl spdy;
            server_name www.quantnet.com;
 

p4guru

Well-known member
#13
that one didn't work, try this one

Code:
#Permanently redirect all org/net/info domains to com
server {
    server_name  .quantnet.com .quantnet.org .quantnet.net .quantnet.info;
    rewrite ^ https://www.quantnet.com$request_uri? permanent;
}

server {
        listen 443 ssl spdy;
            server_name www.quantnet.com;
remember to restart nginx
 

Andy.N

Well-known member
#14
that one didn't work, try this one

Code:
#Permanently redirect all org/net/info domains to com
server {
    server_name  .quantnet.com .quantnet.org .quantnet.net .quantnet.info;
    rewrite ^ https://www.quantnet.com$request_uri? permanent;
}

server {
        listen 443 ssl spdy;
            server_name www.quantnet.com;
remember to restart nginx
No luck.
I got lot of timed out from error log
2013/07/24 16:01:58 [error] 10107#0: *23 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 209.150.45.88, server: quantnet.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "quantnet.com"
 

p4guru

Well-known member
#16
I am curious what you have for your live nginx server vhost ? and whether it's similar or totally different ? Besides the php and static file include conf lines, most nginx vhost would be interchangeable so what works on your live forum nginx server, should work with Centmin Mod. Unless you're live server is nginx as a reverse proxy to apache ?

try

Code:
#Permanently redirect all org/net/info domains to com
server {
    server_name  quantnet.com *.quantnet.org *.quantnet.net *.quantnet.info;
    rewrite ^ https://www.quantnet.com$request_uri? permanent;
}

server {
        listen 443 ssl spdy;
            server_name www.quantnet.com;
Haven't used PHP 5.5 myself much only 5.4.17 and 5.3.27.

On my test server, I just ran centmin.sh and selected
  • menu option #5 to upgrade PHP from 5.4.17 to use to 5.5.1
  • menu options #7 to reinstall APC cache
  • menu option #10 to reinstall memcached
  • menu option #15 to reinstall ImagicK php extension
and my Xenforo test server works fine so not PHP 5.5 related.

Code:
php -v
PHP 5.5.1 (cli) (built: Jul 25 2013 07:29:10)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
edit: do you have any backend Xenforo cache enabled for APC or memcached ? after you upgrade to PHP 5.5.1 need to reinstall APC and memcached and ImagicK extensions via menu options 7, 10 and 15 as well
 
Last edited:

Andy.N

Well-known member
#17
I am curious what you have for your live nginx server vhost ? and whether it's similar or totally different ? Besides the php and static file include conf lines, most nginx vhost would be interchangeable so what works on your live forum nginx server, should work with Centmin Mod. Unless you're live server is nginx as a reverse proxy to apache ?

try

Code:
#Permanently redirect all org/net/info domains to com
server {
    server_name  quantnet.com *.quantnet.org *.quantnet.net *.quantnet.info;
    rewrite ^ https://www.quantnet.com$request_uri? permanent;
}

server {
        listen 443 ssl spdy;
            server_name www.quantnet.com;
Haven't used PHP 5.5 myself much only 5.4.17 and 5.3.27.

On my test server, I just ran centmin.sh and selected
  • menu option #5 to upgrade PHP from 5.4.17 to use to 5.5.1
  • menu options #7 to reinstall APC cache
  • menu option #10 to reinstall memcached
  • menu option #15 to reinstall ImagicK php extension
and my Xenforo test server works fine so not PHP 5.5 related.

Code:
php -v
PHP 5.5.1 (cli) (built: Jul 25 2013 07:29:10)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
edit: do you have any backend Xenforo cache enabled for APC or memcached ? after you upgrade to PHP 5.5.1 need to reinstall APC and memcached and ImagicK extensions via menu options 7, 10 and 15 as well
It's frustrated. This is my second attempt to clone a server to move the live site over.
The live server was set up long time ago by someone else but I think the way they did it is different.

I just updated PHP to 5.5.1 and ran step 7, 10, 15.

I had ACP enabled on the XF backend but removed it.

I have some suspicion that this may have to do with either fastcgi/php-fpm?

I can access files on /public/ but index doesn't seem to work.

Do you have a working conf file that you can share?
 

p4guru

Well-known member
#18
my config is pretty much same as yours with https/ssl/spdy enabled just only difference is I only serving one domain

the equivalent would be

Code:
server {
    server_name  quantnet.com www.quantnet.com;
    rewrite ^ https://$server_name$request_uri? permanent;
}

server {
        listen 443 ssl spdy;
            server_name www.quantnet.com;
is php-fpm even running ? check with these 2 commands

Code:
netstat -plant
look for

Code:
tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      12570/php-fpm
Code:
ps ax | grep php-fpm | grep -v grep
look for

Code:
12570 ?        Ss     0:02 php-fpm: master process (/usr/local/etc/php-fpm.conf)
then try if not running

Code:
service php-fpm restart
or short cut

Code:
fpmrestart
can also go back and check php upgrade logs as per FAQ #7 http://centminmod.com/faq.html to see if php upgrade was successfully done or if there were errors

oh just remembered for https in php.conf include file at include /usr/local/nginx/conf/php.conf need

Code:
fastcgi_param HTTPS on;
short cut to access php.conf is to type

Code:
phpinc
will call nano editor for /usr/local/nginx/conf/php.conf
 
Last edited:

Andy.N

Well-known member
#20
Great point about the fastcgi_param HTTPS on;
It was a big issue when we tried to get nginx working originally years ago on XF.

I uncommented it and check out other thing. This is the one thing that may be the cause
Code:
[root@web centmin-v1.2.3mod]# service php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm Failed loading /usr/local/lib/php/extensions/no-debug-non-zts-20090626/opcache.so:  /usr/local/lib/php/extensions/no-debug-non-zts-20090626/opcache.so: cannot open shared object file: No such file or directory
 done