Welcome! Log In Create A New Profile

Advanced

Upgrading PHP with NGINX

Posted by stonkers 
Upgrading PHP with NGINX
February 19, 2021 11:25AM
So I'm tasked with upgrading php that was installed with NGINX (OS = RHEL 7.9). I installed NGINX from the RHEL repo, but the instructions I followed to add PHP got it from the remi repo. Is it possible for me to move over to the RHEL repo so that I can have it take updates? My immediate concern is getting it up to 7.3.x from 7.2.24 so that the security scan stops fingering me. Any help? Here are steps I followed that I'm sure I found online somewhere, lol...

$yum install nginx

Set up php-fpm to support php running under NGINX:
• rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
• rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
• yum --enablerepo=remi,remi-php72 install php-fpm php-common
• yum --enablerepo=remi,remi-php72 install php-opcache php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongodb php-pecl-redis php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml
• systemctl start php-fpm.service
• systemctl enable php-fpm.service

Thanks!
Eric
Re: Upgrading PHP with NGINX
February 22, 2021 02:20PM
After digging a bit deeper, I find that I can just install 7.3, uninstall the php-fpm, but I'm unsure how to do what I'm doing in nginx with standard php. So after looking at my situation, I'm VERY confused. 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


And honestly, looking at this I'm a bit confused seeing that there is no /etc/nginx/default.d directory, lol...
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 84
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready