Reputation: 43
So I'm tasked with upgrading php that is used by NGINX in RHEL. I installed NGINX from the RHEL repo, but the instructions I followed to add PHP got it from the remi repo. I need to move over to PHP to meet the requirements of our Security team, but unsure how to configure it to do the same as I'm doing. I put this setup together with chicken wire and duct tape to support running 2 sites via NGINX. 1 is a rundeck site, the other is a wiki. With all the config, I'm confused as to how I would repeat the same without the remi install. Here's how I configure it:
Move nginx to port 8080 and separate off 2 sites for rundeck and wiki: $vi /etc/nginx/nginx.conf (modify server block)
server {
listen 8080 default_server;
listen [::]:8080 default_server;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
$vi /etc/nginx/conf.d/rundeck.conf
server {
listen 8080;
listen [::]:8080;
server_name mymachine.mydomain;
access_log /var/log/nginx/mymachine.mydomain.access.log;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
location ^~ /wiki {
alias /var/www/wiki/html;
index index.php;
if (!-e $request_filename) { rewrite ^ /wiki/index.php last; }
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}
location / {
proxy_pass http://localhost:4440;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Change the rundeck config to point to port 8080:
$vi /etc/rundeck/rundeck-config.properties
grails.serverURL=http://mymachine.mydomain:8080
Change the rundeck framework properties file to point to the same server name: $vi /etc/rundeck/framework.properties
framework.server.name = mymachine.mydomain
framework.server.hostname = mymachine.mydomain
framework.server.port = 4440
framework.server.url = http://mymachine.mydomain:4440
Any help? Thanks!
Upvotes: 0
Views: 224
Reputation: 2488
This is a server administration task and has nothing to do with PHP programming...
PHP-FPM runs on a separate server, or in your case, in a separate process on the same server. Requests are forwarded to this FPM server via port 9000 (the fastcgi_pass instruction).
The nginx webserver listens on port 8080, but you can basically use any port you'd want. Nevertheless, if you configure the same "server" to listen on multiple ports, it's still the same site (= same document root directory) - which is btw missing in your config...
But you can create a second "server" section and configure another site (=document root)...
Upvotes: 0