Hey y'all
I'm trying to work out the following configuration; to preface this, I have a working Nginx/PHP FastCGI implementation working on a server with a single ip address, no FQDN and/or DNS serving a single PHP-based web site/application. Now, I've got the same scenario regarding another server, the difference being the requirement to server multiple client sites (one being a Wordpress site). I'm also NOT an Nginx expert by any stretch of the imagination to date.
For an overview:
Document root for the server block is '/usr/share/nginx/html', the Nginx default. Serves up fine, not an issues from http://xxx.xxx.xxx.76. Now the requirement is to have clients enter into their browser address http://xxx.xxx.xxx.76/pmhs as an example. Their php-based site would then be served, and so on for http://xxx.xxx.xxx.76/client for any other sites to be configured and served. The document root directory for these clients are in a standard CentOS 7 folder '/srv' where all clients are configured as having site content available in their '/srv/www/{client}.production/public_html' folder. Most of the configuration examples I've been able to dig up aren't really specific to this type of config, most if not all have some sort of server and/or dns involved making routing a bit more understandable (in my view at this juncture).
I've attached the configuration file that's in play. I can capture the client location with a regex, but then it starts to get a little 'blurry' for myself regarding what to do next based on what I see happening. When I CURL to the base ip addy, it's what is expected, the Nginx 'welcome' page is returned. Now when I a pass the same addy with a client name (with the return 200 $document_root$uri; uncommented), the document_url has been aliased correctly, but now I'm sort of at a momentary loss. Ultimately, I'd like to get all client sites configured proxied to the php-fpm fastcgi proxy for service (that would be why there's $port code defined, but not used as of yet). Just looking for any direction, etc on how to clean this up and get it working properly while further educating myself on Nginx configuration in the process...
What the goal would be is this:
URL = xxx.xxx.xxx.76 or xxx.xxx.xxx.76/
Serve -> /usr/share/nginx/html/(*.html)
root /usr/share/nginx/html;
(*currently working per this config*)
URL = xxx.xxx.xxx.76/pmhs or xxx.xxx.xxx.76/pmhs/
Serve -> /srv/www/pmhs.production/public_html/(*.php)
root srv/www/pmhs.production/public_html;
URL = xxx.xxx.xxx.76/acme or xxx.xxx.xxx.76/acme/
Serve -> /srv/www/acme.production/public_html/(*.php)
root srv/www/acme.production/public_html;
Does any of this makes sense? I think I'm pretty close, but I just don't know if that's the case or not. You can flame on too, but understand I'm merely learning some of this by the seat of my pants as I go along. That all being said, any/all input, ideas, constructive criticism, etal all welcome and greatly appreciated.
Thanx SO MUCH in advance...
I'm trying to work out the following configuration; to preface this, I have a working Nginx/PHP FastCGI implementation working on a server with a single ip address, no FQDN and/or DNS serving a single PHP-based web site/application. Now, I've got the same scenario regarding another server, the difference being the requirement to server multiple client sites (one being a Wordpress site). I'm also NOT an Nginx expert by any stretch of the imagination to date.
For an overview:
Document root for the server block is '/usr/share/nginx/html', the Nginx default. Serves up fine, not an issues from http://xxx.xxx.xxx.76. Now the requirement is to have clients enter into their browser address http://xxx.xxx.xxx.76/pmhs as an example. Their php-based site would then be served, and so on for http://xxx.xxx.xxx.76/client for any other sites to be configured and served. The document root directory for these clients are in a standard CentOS 7 folder '/srv' where all clients are configured as having site content available in their '/srv/www/{client}.production/public_html' folder. Most of the configuration examples I've been able to dig up aren't really specific to this type of config, most if not all have some sort of server and/or dns involved making routing a bit more understandable (in my view at this juncture).
I've attached the configuration file that's in play. I can capture the client location with a regex, but then it starts to get a little 'blurry' for myself regarding what to do next based on what I see happening. When I CURL to the base ip addy, it's what is expected, the Nginx 'welcome' page is returned. Now when I a pass the same addy with a client name (with the return 200 $document_root$uri; uncommented), the document_url has been aliased correctly, but now I'm sort of at a momentary loss. Ultimately, I'd like to get all client sites configured proxied to the php-fpm fastcgi proxy for service (that would be why there's $port code defined, but not used as of yet). Just looking for any direction, etc on how to clean this up and get it working properly while further educating myself on Nginx configuration in the process...
What the goal would be is this:
URL = xxx.xxx.xxx.76 or xxx.xxx.xxx.76/
Serve -> /usr/share/nginx/html/(*.html)
root /usr/share/nginx/html;
(*currently working per this config*)
URL = xxx.xxx.xxx.76/pmhs or xxx.xxx.xxx.76/pmhs/
Serve -> /srv/www/pmhs.production/public_html/(*.php)
root srv/www/pmhs.production/public_html;
URL = xxx.xxx.xxx.76/acme or xxx.xxx.xxx.76/acme/
Serve -> /srv/www/acme.production/public_html/(*.php)
root srv/www/acme.production/public_html;
Does any of this makes sense? I think I'm pretty close, but I just don't know if that's the case or not. You can flame on too, but understand I'm merely learning some of this by the seat of my pants as I go along. That all being said, any/all input, ideas, constructive criticism, etal all welcome and greatly appreciated.
Thanx SO MUCH in advance...