Question: The Nautilus application development team is planning to launch a new PHP-based application, which they want to deploy on Nautilus infra in Stratos DC. The development team had a meeting with the production support team and they have shared some requirements regarding the infrastructure. Below are the requirements they shared:
a. Install nginx on app server 1 , configure it to use port 8098 and its document root should be /var/www/html.
b. Install php-fpm version 7.3 on app server 1, it should listen on port 9000.
c. Configure php-fpm and nginx to work together.
d. There is an index.php file on jump host at location /tmp that needs to be copied under the document root on the nginx server.
e. Once configured correctly you can access the website usng APP button on the top bar.
Please Note:- Perform the below commands based on your question server, user name & other details that might differ. So please read the task carefully before executing it. All the Best 👍
1. Login on App server as per the task & switch to root user
thor@jump_host
~$ ssh tony@stapp01 The authenticity
of host 'stapp01 (172.16.238.10)' can't be established. ECDSA key
fingerprint is SHA256:SySamszyWhhLGFiybhGBqfrr8g55wS/3e37ZpBOvICs. ECDSA key
fingerprint is MD5:6d:31:18:2a:f9:07:f3:29:dd:0a:d3:1f:6e:04:0a:db. Are you sure you
want to continue connecting (yes/no)? yes Warning:
Permanently added 'stapp01,172.16.238.10' (ECDSA) to the list of known hosts. tony@stapp01's
password: [tony@stapp01
~]$ sudo su - We trust you have received the usual lecture from the local System Administrator.
It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great
responsibility. [sudo] password for tony: [root@stapp01
~]# |
2. To install Nginx we need to install epel repo first
[root@stapp01
~]# yum install epel-release Loaded plugins:
fastestmirror, ovl Loading mirror
speeds from cached hostfile * base: mirrors.gigenet.com * extras: mirrors.cmich.edu * updates: mirror.rackspace.com Resolving
Dependencies --> Running
transaction check ---> Package
epel-release.noarch 0:7-11 will be installed --> Finished
Dependency Resolution Dependencies Resolved ====================================================================================================== Package Arch Version Repository Size ====================================================================================================== Installing: epel-release noarch 7-11 extras 15 k Transaction Summary ====================================================================================================== Install 1 Package Total download size: 15 k Installed size:
24 k Is this ok
[y/d/N]: y Downloading
packages: epel-release-7-11.noarch.rpm
| 15 kB 00:00:00
Running transaction
check Running
transaction test Transaction test
succeeded Running
transaction Installing : epel-release-7-11.noarch
1/1 Verifying
: epel-release-7-11.noarch 1/1 Installed: epel-release.noarch 0:7-11
Complete! [root@stapp01
~]# |
3. Now Install Nginx
[root@stapp01
~]# yum install nginx Loaded plugins:
fastestmirror, ovl Loading mirror
speeds from cached hostfile epel/x86_64/metalink
| 15 kB 00:00:00
* base: mirrors.gigenet.com * epel: ord.mirror.rackspace.com * extras: mirrors.cmich.edu * updates: mirror.rackspace.com epel
| 4.7 kB 00:00:00 (1/3):
epel/x86_64/updateinfo
| 1.0 MB 00:00:00 (2/3):
epel/x86_64/group_gz
| 96 kB 00:00:00
(3/3):
epel/x86_64/primary_db
| 7.0 MB 00:00:01
====================================================================================================== Package Arch Version Repository Size ====================================================================================================== Installing: nginx x86_64 1:1.20.1-2.el7 epel 586 k Installing for
dependencies: centos-indexhtml noarch 7-9.el7.centos base 92 k centos-logos noarch 70.0.6-3.el7.centos base 21 M gperftools-libs x86_64 2.6.1-1.el7 base 272 k make x86_64 1:3.82-24.el7 base 421 k nginx-filesystem noarch 1:1.20.1-2.el7 epel 23 k openssl x86_64 1:1.0.2k-21.el7_9 updates 493 k openssl11-libs x86_64 1:1.1.1g-3.el7 epel 1.5 M Updating for
dependencies: openssl-libs x86_64 1:1.0.2k-21.el7_9 updates 1.2 M
Transaction
Summary ====================================================================================================== Install 1 Package
(+7 Dependent packages) Upgrade ( 1 Dependent package)
Total download
size: 26 M Is this ok
[y/d/N]: y Downloading
packages: Delta RPMs
disabled because /usr/bin/applydeltarpm not installed. (1/9):
gperftools-libs-2.6.1-1.el7.x86_64.rpm | 272 kB
00:00:00 (2/9):
centos-indexhtml-7-9.el7.centos.noarch.rpm | 92 kB
00:00:00 (3/9):
make-3.82-24.el7.x86_64.rpm
| 421 kB 00:00:00 warning:
/var/cache/yum/x86_64/7/epel/packages/nginx-1.20.1-2.el7.x86_64.rpm: Header
V4 RSA/SHA256 Signature, key ID 352c64e5: NOKEY Public key for
nginx-1.20.1-2.el7.x86_64.rpm is not installed (4/9):
nginx-1.20.1-2.el7.x86_64.rpm |
586 kB 00:00:00 (5/9):
nginx-filesystem-1.20.1-2.el7.noarch.rpm | 23 kB
00:00:00 (6/9):
openssl-1.0.2k-21.el7_9.x86_64.rpm | 493
kB 00:00:00 (7/9):
openssl-libs-1.0.2k-21.el7_9.x86_64.rpm | 1.2
MB 00:00:00 (8/9):
openssl11-libs-1.1.1g-3.el7.x86_64.rpm | 1.5
MB 00:00:00 (9/9):
centos-logos-70.0.6-3.el7.centos.noarch.rpm | 21 MB
00:00:02 ------------------------------------------------------------------------------------------------------ Total
11 MB/s | 26 MB 00:00:02
Retrieving key
from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 Importing GPG
key 0x352C64E5: Userid
: "Fedora EPEL (7) <epel@fedoraproject.org>" Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f
6a2f aea2 352c 64e5 Package
: epel-release-7-11.noarch (@extras) From
: /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 Is this ok
[y/N]: y Running
transaction check Running
transaction test Transaction test
succeeded Installed: nginx.x86_64 1:1.20.1-2.el7
Dependency Updated: openssl-libs.x86_64 1:1.0.2k-21.el7_9 Complete! [root@stapp01
~]# |
4. For installing php-fpm install the php repo
[root@stapp01
~]# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm Loaded plugins:
fastestmirror, ovl remi-release-7.rpm
| 23 kB 00:00:00
Examining
/var/tmp/yum-root-whEDrC/remi-release-7.rpm:
remi-release-7.9-2.el7.remi.noarch Marking
/var/tmp/yum-root-whEDrC/remi-release-7.rpm to be installed Resolving
Dependencies --> Running
transaction check ---> Package
remi-release.noarch 0:7.9-2.el7.remi will be installed --> Finished
Dependency Resolution
Dependencies
Resolved
====================================================================================================== Package Arch Version Repository Size ====================================================================================================== Installing: remi-release noarch 7.9-2.el7.remi /remi-release-7 32 k
Transaction
Summary ====================================================================================================== Install 1 Package
Total size: 32 k Installed size:
32 k Is this ok
[y/d/N]: y Downloading
packages: Running
transaction check Running
transaction test Transaction test
succeeded Running
transaction Installing :
remi-release-7.9-2.el7.remi.noarch
1/1 Verifying
: remi-release-7.9-2.el7.remi.noarch 1/1
Installed: remi-release.noarch 0:7.9-2.el7.remi
Complete! [root@stapp01
~]# |
5. Disable the default PHP-fpm version repo
[root@stapp01
~]# yum-config-manager --disable remi-php54 |
6. Make sure you Enable PHP-fpm version repo as per the task
[root@stapp01
~]# yum-config-manager --enable remi-php73 |
7. Edit the Nginx configuration
[root@stapp01
nginx]# vi /etc/nginx/nginx.conf [root@stapp01 nginx]# cat /etc/nginx/nginx.conf server { listen 8098;
listen [::]:8098;
server_name _; root /var/www/html; # Load configuration files for the
default server block.
include /etc/nginx/default.d/*.conf; location ~ \.php$ {
try_files $uri = 404;
include fastcgi_params; fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; }
location /
{
index
index.php index.html index.htm; } error_page 404 /404.html;
location = /404.html |
8. Kindly refer to the below video for further configuration of PHP-fpm
Happy Learning!!!!
Apart from this if you need more clarity, I have made a tutorial video on this, please go through and share your comments. Like and share the knowledge
0 Comments