SlideShare une entreprise Scribd logo
1  sur  12
Télécharger pour lire hors ligne
2020
6/6/2020
Installing PHP 7.4 Nginx 1.14 PHP-
FPM & Laravel 7.15 on CENTOS 8
Page | 1
Installing PHP 7.4 Nginx 1.14
PHP-FPM & Laravel 7.15 on
CENTOS 8
Contents
Step 1) Enable EPEL and Remi Repository.............................................................................................................2
Step 2) Enable latest PHP Module Stream (remi-7.4)........................................................................................2
Step 3) Install and Verify PHP 7.4..............................................................................................................................3
Step 4) Start Nginx Php-FPM......................................................................................................................................3
Step 5) Enabling HTTPS/HTTPS..................................................................................................................................3
Step 6) Configuring and Securing PHP-FPM and Nginx..................................................................................4
Step 7) Configuring Timezone ...................................................................................................................................4
Step 8) Configuring Pathinfo......................................................................................................................................5
Step 9) Configuring Security Limit............................................................................................................................5
Step 10) Installing Composer & Laravel Framework .........................................................................................6
Step 11) Creating Laravel Project..............................................................................................................................6
Step 12) Configuring Nginx Server Block for Laravel ........................................................................................7
Step 13) Update the Security Context.....................................................................................................................9
Step 14) Accessing Laravel Website from a Web Browser ........................................................................... 10
Page | 2
Step 1) Enable EPEL and Remi Repository
In the default CentOS 8 and RHEL 8 package repositories, PHP 7.2 / 7.3 is available
and to install latest version of PHP 7.4, we must configure EPEL and REMI
repositories, so to enable the repositories, run the following commands:
[root@centos8]# dnf install epel-release -y
[root@centos8]# dnf install
https://rpms.remirepo.net/enterprise/remi-release-8.rpm -y
[root@centos8]# dnf module list php
As we can see in above output, PHP 7.2 is the default package from CentOS-8
AppStream repository, so in the next step, we will enable latest PHP module stream
(redmi-7.4) so that when we install install PHP using dnf then it will automatically
pick packages from remi-7.4 module
Step 2) Enable latest PHP Module Stream
(remi-7.4)
[root@centos8]# dnf module list php
[root@centos8]# dnf module enable php:remi-7.4
Page | 3
Step 3) Install and Verify PHP 7.4
[root@centos8]# dnf install nginx php php-cli php-common php-fpm
php-xml php-mbstring php-json php-zip php-mysqlnd
[root@centos8]#php -v #php version, should be 7.4
Step 4) Start Nginx Php-FPM
[root@centos8]# systemctl start php-fpm nginx
[root@centos8]# systemctl enable php-fpm nginx
[root@centos8]# systemctl status php-fpm nginx
Step 5) Enabling HTTPS/HTTPS
[root@centos8]# firewall-cmd --zone=public --permanent --add-
service=http
[root@centos8]# firewall-cmd --zone=public --permanent --add-
service=https
[root@centos8]# firewall-cmd –reload
Page | 4
Step 6) Configuring and Securing PHP-
FPM and Nginx
[root@centos8]# nano /etc/php-fpm.d/www.conf
Uncomment the following parameters and set their values to the user and group
to match the user and group Nginx is running as:
listen.owner = nginx
listen.group = nginx
listen.mode = 066
Step 7) Configuring Timezone
[root@centos8]# nano /etc/php.ini
Page | 5
date.timezone = Asia/Kuala_Lumpur
Step 8) Configuring Pathinfo
Change cgi.fix_pathinfo=1 to cgi.fix_pathinfo=0
Step 9) Configuring Security Limit
Uncomment security.limit_extensions = .php .php3 .php4 .php5
.php7 inside /etc/php-fpm.d/www.conf file
Page | 6
Step 10) Installing Composer & Laravel
Framework
[root@centos8]# curl -sS https://getcomposer.org/installer | php
[root@centos8]# mv composer.phar /usr/local/bin/composer
[root@centos8]# chmod +x /usr/local/bin/composer
Step 11) Creating Laravel Project
[root@centos8]# cd /var/www/html/
[root@centos8]# composer create-project --prefer-dist
laravel/laravel <<project_name>>
Page | 7
Step 12) Configuring Nginx Server Block
for Laravel
[root@centos8]# nano /etc/nginx/conf.d/<<project_name>>.conf
# copy and paste the following into the <<project_name>>.conf
server {
listen 80;
server_name <<project_name>>.;
root /var/www/html/<<project_name>>/public;
index index.php;
charset utf-8;
gzip on;
gzip_types text/css application/javascript text/javascript
application/x-javascript image/svg+xml text/plain text/xsd text/xsl text/xml
image/x-icon;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ .php {
include fastcgi.conf;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/run/php-fpm/www.sock;
}
location ~ /.ht {
deny all;
}
}
Page | 8
# Save the file and check if the Nginx configuration syntax is correct by running.
[root@centos8]#nginx -t
[root@centos8]# systemctl restart php-fpm
[root@centos8]# systemctl restart nginx
Page | 9
Step 13) Update the Security Context
[root@centos8#yum -y install policycoreutils-python-utils
[root@centos8#semanage fcontext -a -t httpd_sys_rw_content_t
'/var/www/html/<<project_name>>(/.*)?'
[root@centos8#semanage fcontext -a -t httpd_sys_rw_content_t
'/var/www/html/<<project_name>>/public(/.*)?'
[root@centos8#semanage fcontext -a -t httpd_sys_rw_content_t
'/var/www/html/<<project_name>>/storage(/.*)?'
[root@centos8#semanage fcontext -a -t httpd_sys_rw_content_t
'/var/www/html/<<project_name>>/app(/.*)?'
[root@centos8#semanage fcontext -a -t httpd_sys_rw_content_t
'/var/www/html/<<project_name>>/bootstrap(/.*)?'
[root@centos8#semanage fcontext -a -t httpd_sys_rw_content_t
'/var/www/html/<<project_name>>/config(/.*)?'
[root@centos8#semanage fcontext -a -t httpd_sys_rw_content_t
'/var/www/html/<<project_name>>/database(/.*)?'
[root@centos8#semanage fcontext -a -t httpd_sys_rw_content_t
'/var/www/html/<<project_name>>/resources(/.*)?'
[root@centos8#semanage fcontext -a -t httpd_sys_rw_content_t
'/var/www/html/<<project_name>>/routes(/.*)?'
[root@centos8#semanage fcontext -a -t httpd_sys_rw_content_t
'/var/www/html/<<project_name>>/vendor(/.*)?'
[root@centos8#semanage fcontext -a -t httpd_sys_rw_content_t
'/var/www/html/<<project_name>>/tests(/.*)?'
[root@centos8#restorecon -Rv '/var/www/html/<<project_name>>/'
Page | 10
Step 14) Accessing Laravel Website from a
Web Browser
Type the following command to get the IP address of the current
server:
[root@centos8#ip ad
Create the host name inside the hosts file in /etc/hosts .
Next, open a web browser on the local machine and use the following address
to navigate.
http://<<project_name>>
Page | 11

Contenu connexe

Tendances

ProxySQL on Kubernetes
ProxySQL on KubernetesProxySQL on Kubernetes
ProxySQL on KubernetesRené Cannaò
 
마이크로서비스를 위한 AWS 아키텍처 패턴 및 모범 사례 - AWS Summit Seoul 2017
마이크로서비스를 위한 AWS 아키텍처 패턴 및 모범 사례 - AWS Summit Seoul 2017마이크로서비스를 위한 AWS 아키텍처 패턴 및 모범 사례 - AWS Summit Seoul 2017
마이크로서비스를 위한 AWS 아키텍처 패턴 및 모범 사례 - AWS Summit Seoul 2017Amazon Web Services Korea
 
Docker 간단 개념 / Docker 를 이용한 MSA 기반의 Spring Boot 프로젝트 - DSmentoring 정다운
Docker 간단 개념 / Docker 를 이용한 MSA 기반의 Spring Boot 프로젝트 - DSmentoring 정다운Docker 간단 개념 / Docker 를 이용한 MSA 기반의 Spring Boot 프로젝트 - DSmentoring 정다운
Docker 간단 개념 / Docker 를 이용한 MSA 기반의 Spring Boot 프로젝트 - DSmentoring 정다운다운 정
 
[오픈소스컨설팅]Day #2 MySQL Tuning, Replication, Cluster
[오픈소스컨설팅]Day #2 MySQL Tuning, Replication, Cluster[오픈소스컨설팅]Day #2 MySQL Tuning, Replication, Cluster
[오픈소스컨설팅]Day #2 MySQL Tuning, Replication, ClusterJi-Woong Choi
 
Git을 조금 더 알아보자!
Git을 조금 더 알아보자!Git을 조금 더 알아보자!
Git을 조금 더 알아보자!Young Kim
 
[네전따] 네트워크 엔지니어에게 쿠버네티스는 어떤 의미일까요
[네전따] 네트워크 엔지니어에게 쿠버네티스는 어떤 의미일까요[네전따] 네트워크 엔지니어에게 쿠버네티스는 어떤 의미일까요
[네전따] 네트워크 엔지니어에게 쿠버네티스는 어떤 의미일까요Jo Hoon
 
Lessons learned from writing over 300,000 lines of infrastructure code
Lessons learned from writing over 300,000 lines of infrastructure codeLessons learned from writing over 300,000 lines of infrastructure code
Lessons learned from writing over 300,000 lines of infrastructure codeYevgeniy Brikman
 
PostgreSQL Performance Tables Partitioning vs. Aggregated Data Tables
PostgreSQL Performance Tables Partitioning vs. Aggregated Data TablesPostgreSQL Performance Tables Partitioning vs. Aggregated Data Tables
PostgreSQL Performance Tables Partitioning vs. Aggregated Data TablesSperasoft
 
Learn nginx in 90mins
Learn nginx in 90minsLearn nginx in 90mins
Learn nginx in 90minsLarry Cai
 
[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오
[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오
[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오PgDay.Seoul
 
Deep dive into Vue.js
Deep dive into Vue.jsDeep dive into Vue.js
Deep dive into Vue.js선협 이
 
RESTful API 제대로 만들기
RESTful API 제대로 만들기RESTful API 제대로 만들기
RESTful API 제대로 만들기Juwon Kim
 
왜 쿠버네티스는 systemd로 cgroup을 관리하려고 할까요
왜 쿠버네티스는 systemd로 cgroup을 관리하려고 할까요왜 쿠버네티스는 systemd로 cgroup을 관리하려고 할까요
왜 쿠버네티스는 systemd로 cgroup을 관리하려고 할까요Jo Hoon
 
AEM (CQ) Dispatcher Security and CDN+Browser Caching
AEM (CQ) Dispatcher Security and CDN+Browser CachingAEM (CQ) Dispatcher Security and CDN+Browser Caching
AEM (CQ) Dispatcher Security and CDN+Browser CachingAndrew Khoury
 
How to create a camera2
How to create a camera2How to create a camera2
How to create a camera2Booch Lin
 
Web application development with Django framework
Web application development with Django frameworkWeb application development with Django framework
Web application development with Django frameworkflapiello
 
IaC로 AWS인프라 관리하기 - 이진성 (AUSG) :: AWS Community Day Online 2021
IaC로 AWS인프라 관리하기 - 이진성 (AUSG) :: AWS Community Day Online 2021IaC로 AWS인프라 관리하기 - 이진성 (AUSG) :: AWS Community Day Online 2021
IaC로 AWS인프라 관리하기 - 이진성 (AUSG) :: AWS Community Day Online 2021AWSKRUG - AWS한국사용자모임
 

Tendances (20)

ProxySQL on Kubernetes
ProxySQL on KubernetesProxySQL on Kubernetes
ProxySQL on Kubernetes
 
마이크로서비스를 위한 AWS 아키텍처 패턴 및 모범 사례 - AWS Summit Seoul 2017
마이크로서비스를 위한 AWS 아키텍처 패턴 및 모범 사례 - AWS Summit Seoul 2017마이크로서비스를 위한 AWS 아키텍처 패턴 및 모범 사례 - AWS Summit Seoul 2017
마이크로서비스를 위한 AWS 아키텍처 패턴 및 모범 사례 - AWS Summit Seoul 2017
 
Docker 간단 개념 / Docker 를 이용한 MSA 기반의 Spring Boot 프로젝트 - DSmentoring 정다운
Docker 간단 개념 / Docker 를 이용한 MSA 기반의 Spring Boot 프로젝트 - DSmentoring 정다운Docker 간단 개념 / Docker 를 이용한 MSA 기반의 Spring Boot 프로젝트 - DSmentoring 정다운
Docker 간단 개념 / Docker 를 이용한 MSA 기반의 Spring Boot 프로젝트 - DSmentoring 정다운
 
[오픈소스컨설팅]Day #2 MySQL Tuning, Replication, Cluster
[오픈소스컨설팅]Day #2 MySQL Tuning, Replication, Cluster[오픈소스컨설팅]Day #2 MySQL Tuning, Replication, Cluster
[오픈소스컨설팅]Day #2 MySQL Tuning, Replication, Cluster
 
Git을 조금 더 알아보자!
Git을 조금 더 알아보자!Git을 조금 더 알아보자!
Git을 조금 더 알아보자!
 
Sequelize
SequelizeSequelize
Sequelize
 
[네전따] 네트워크 엔지니어에게 쿠버네티스는 어떤 의미일까요
[네전따] 네트워크 엔지니어에게 쿠버네티스는 어떤 의미일까요[네전따] 네트워크 엔지니어에게 쿠버네티스는 어떤 의미일까요
[네전따] 네트워크 엔지니어에게 쿠버네티스는 어떤 의미일까요
 
New PHP Exploitation Techniques
New PHP Exploitation TechniquesNew PHP Exploitation Techniques
New PHP Exploitation Techniques
 
Lessons learned from writing over 300,000 lines of infrastructure code
Lessons learned from writing over 300,000 lines of infrastructure codeLessons learned from writing over 300,000 lines of infrastructure code
Lessons learned from writing over 300,000 lines of infrastructure code
 
PostgreSQL Performance Tables Partitioning vs. Aggregated Data Tables
PostgreSQL Performance Tables Partitioning vs. Aggregated Data TablesPostgreSQL Performance Tables Partitioning vs. Aggregated Data Tables
PostgreSQL Performance Tables Partitioning vs. Aggregated Data Tables
 
Learn nginx in 90mins
Learn nginx in 90minsLearn nginx in 90mins
Learn nginx in 90mins
 
Docker architecture-04-1
Docker architecture-04-1Docker architecture-04-1
Docker architecture-04-1
 
[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오
[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오
[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오
 
Deep dive into Vue.js
Deep dive into Vue.jsDeep dive into Vue.js
Deep dive into Vue.js
 
RESTful API 제대로 만들기
RESTful API 제대로 만들기RESTful API 제대로 만들기
RESTful API 제대로 만들기
 
왜 쿠버네티스는 systemd로 cgroup을 관리하려고 할까요
왜 쿠버네티스는 systemd로 cgroup을 관리하려고 할까요왜 쿠버네티스는 systemd로 cgroup을 관리하려고 할까요
왜 쿠버네티스는 systemd로 cgroup을 관리하려고 할까요
 
AEM (CQ) Dispatcher Security and CDN+Browser Caching
AEM (CQ) Dispatcher Security and CDN+Browser CachingAEM (CQ) Dispatcher Security and CDN+Browser Caching
AEM (CQ) Dispatcher Security and CDN+Browser Caching
 
How to create a camera2
How to create a camera2How to create a camera2
How to create a camera2
 
Web application development with Django framework
Web application development with Django frameworkWeb application development with Django framework
Web application development with Django framework
 
IaC로 AWS인프라 관리하기 - 이진성 (AUSG) :: AWS Community Day Online 2021
IaC로 AWS인프라 관리하기 - 이진성 (AUSG) :: AWS Community Day Online 2021IaC로 AWS인프라 관리하기 - 이진성 (AUSG) :: AWS Community Day Online 2021
IaC로 AWS인프라 관리하기 - 이진성 (AUSG) :: AWS Community Day Online 2021
 

Similaire à Installing php 7.4 Nginx Laravel 7.x on Centos 8

How to install and configure LEMP stack
How to install and configure LEMP stackHow to install and configure LEMP stack
How to install and configure LEMP stackRootGate
 
Tested install-isp config3-ubuntu-16-04
Tested install-isp config3-ubuntu-16-04Tested install-isp config3-ubuntu-16-04
Tested install-isp config3-ubuntu-16-04SANTIAGO HERNÁNDEZ
 
How To Install Openbravo ERP 2.50 MP43 in Ubuntu
How To Install Openbravo ERP 2.50 MP43 in UbuntuHow To Install Openbravo ERP 2.50 MP43 in Ubuntu
How To Install Openbravo ERP 2.50 MP43 in UbuntuWirabumi Software
 
L.A.M.P Installation Note --- CentOS 6.5
L.A.M.P Installation Note --- CentOS 6.5L.A.M.P Installation Note --- CentOS 6.5
L.A.M.P Installation Note --- CentOS 6.5William Lee
 
PHP QA Tools
PHP QA ToolsPHP QA Tools
PHP QA Toolsrjsmelo
 
A Continuous Packaging Pipeline
A Continuous Packaging PipelineA Continuous Packaging Pipeline
A Continuous Packaging PipelineMaciej Pasternacki
 
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHPHands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHPDana Luther
 
Deployer - Deployment tool for PHP
Deployer - Deployment tool for PHPDeployer - Deployment tool for PHP
Deployer - Deployment tool for PHPhernanibf
 
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google CloudDrupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google CloudDropsolid
 
OSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshopOSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshopleffen
 
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...addame
 
Hands on Docker - Launch your own LEMP or LAMP stack
Hands on Docker -  Launch your own LEMP or LAMP stackHands on Docker -  Launch your own LEMP or LAMP stack
Hands on Docker - Launch your own LEMP or LAMP stackDana Luther
 
Drupal camp South Florida 2011 - Introduction to the Aegir hosting platform
Drupal camp South Florida 2011 - Introduction to the Aegir hosting platformDrupal camp South Florida 2011 - Introduction to the Aegir hosting platform
Drupal camp South Florida 2011 - Introduction to the Aegir hosting platformHector Iribarne
 
Managing and Monitoring Application Performance
Managing and Monitoring Application PerformanceManaging and Monitoring Application Performance
Managing and Monitoring Application PerformanceSebastian Marek
 
Speed up your development environment PHP + Nginx + Fedora + PG
Speed up your development environment PHP + Nginx + Fedora + PGSpeed up your development environment PHP + Nginx + Fedora + PG
Speed up your development environment PHP + Nginx + Fedora + PGMarcus Sá
 
Deploying nginx with minimal system resources
Deploying nginx with minimal system resourcesDeploying nginx with minimal system resources
Deploying nginx with minimal system resourcesMax Ukhanov
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindProfiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindSam Keen
 

Similaire à Installing php 7.4 Nginx Laravel 7.x on Centos 8 (20)

How to install and configure LEMP stack
How to install and configure LEMP stackHow to install and configure LEMP stack
How to install and configure LEMP stack
 
Tested install-isp config3-ubuntu-16-04
Tested install-isp config3-ubuntu-16-04Tested install-isp config3-ubuntu-16-04
Tested install-isp config3-ubuntu-16-04
 
How To Install Openbravo ERP 2.50 MP43 in Ubuntu
How To Install Openbravo ERP 2.50 MP43 in UbuntuHow To Install Openbravo ERP 2.50 MP43 in Ubuntu
How To Install Openbravo ERP 2.50 MP43 in Ubuntu
 
L.A.M.P Installation Note --- CentOS 6.5
L.A.M.P Installation Note --- CentOS 6.5L.A.M.P Installation Note --- CentOS 6.5
L.A.M.P Installation Note --- CentOS 6.5
 
PHP QA Tools
PHP QA ToolsPHP QA Tools
PHP QA Tools
 
A Continuous Packaging Pipeline
A Continuous Packaging PipelineA Continuous Packaging Pipeline
A Continuous Packaging Pipeline
 
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHPHands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
 
Deployer - Deployment tool for PHP
Deployer - Deployment tool for PHPDeployer - Deployment tool for PHP
Deployer - Deployment tool for PHP
 
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google CloudDrupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
 
OSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshopOSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshop
 
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
 
Hands on Docker - Launch your own LEMP or LAMP stack
Hands on Docker -  Launch your own LEMP or LAMP stackHands on Docker -  Launch your own LEMP or LAMP stack
Hands on Docker - Launch your own LEMP or LAMP stack
 
Drupal camp South Florida 2011 - Introduction to the Aegir hosting platform
Drupal camp South Florida 2011 - Introduction to the Aegir hosting platformDrupal camp South Florida 2011 - Introduction to the Aegir hosting platform
Drupal camp South Florida 2011 - Introduction to the Aegir hosting platform
 
Managing and Monitoring Application Performance
Managing and Monitoring Application PerformanceManaging and Monitoring Application Performance
Managing and Monitoring Application Performance
 
Speed up your development environment PHP + Nginx + Fedora + PG
Speed up your development environment PHP + Nginx + Fedora + PGSpeed up your development environment PHP + Nginx + Fedora + PG
Speed up your development environment PHP + Nginx + Fedora + PG
 
Installing lemp with ssl and varnish on Debian 9
Installing lemp with ssl and varnish on Debian 9Installing lemp with ssl and varnish on Debian 9
Installing lemp with ssl and varnish on Debian 9
 
Deploying nginx with minimal system resources
Deploying nginx with minimal system resourcesDeploying nginx with minimal system resources
Deploying nginx with minimal system resources
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindProfiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
 
Devopstore
DevopstoreDevopstore
Devopstore
 
PHP selber bauen
PHP selber bauenPHP selber bauen
PHP selber bauen
 

Dernier

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 

Dernier (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

Installing php 7.4 Nginx Laravel 7.x on Centos 8

  • 1. 2020 6/6/2020 Installing PHP 7.4 Nginx 1.14 PHP- FPM & Laravel 7.15 on CENTOS 8
  • 2. Page | 1 Installing PHP 7.4 Nginx 1.14 PHP-FPM & Laravel 7.15 on CENTOS 8 Contents Step 1) Enable EPEL and Remi Repository.............................................................................................................2 Step 2) Enable latest PHP Module Stream (remi-7.4)........................................................................................2 Step 3) Install and Verify PHP 7.4..............................................................................................................................3 Step 4) Start Nginx Php-FPM......................................................................................................................................3 Step 5) Enabling HTTPS/HTTPS..................................................................................................................................3 Step 6) Configuring and Securing PHP-FPM and Nginx..................................................................................4 Step 7) Configuring Timezone ...................................................................................................................................4 Step 8) Configuring Pathinfo......................................................................................................................................5 Step 9) Configuring Security Limit............................................................................................................................5 Step 10) Installing Composer & Laravel Framework .........................................................................................6 Step 11) Creating Laravel Project..............................................................................................................................6 Step 12) Configuring Nginx Server Block for Laravel ........................................................................................7 Step 13) Update the Security Context.....................................................................................................................9 Step 14) Accessing Laravel Website from a Web Browser ........................................................................... 10
  • 3. Page | 2 Step 1) Enable EPEL and Remi Repository In the default CentOS 8 and RHEL 8 package repositories, PHP 7.2 / 7.3 is available and to install latest version of PHP 7.4, we must configure EPEL and REMI repositories, so to enable the repositories, run the following commands: [root@centos8]# dnf install epel-release -y [root@centos8]# dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm -y [root@centos8]# dnf module list php As we can see in above output, PHP 7.2 is the default package from CentOS-8 AppStream repository, so in the next step, we will enable latest PHP module stream (redmi-7.4) so that when we install install PHP using dnf then it will automatically pick packages from remi-7.4 module Step 2) Enable latest PHP Module Stream (remi-7.4) [root@centos8]# dnf module list php [root@centos8]# dnf module enable php:remi-7.4
  • 4. Page | 3 Step 3) Install and Verify PHP 7.4 [root@centos8]# dnf install nginx php php-cli php-common php-fpm php-xml php-mbstring php-json php-zip php-mysqlnd [root@centos8]#php -v #php version, should be 7.4 Step 4) Start Nginx Php-FPM [root@centos8]# systemctl start php-fpm nginx [root@centos8]# systemctl enable php-fpm nginx [root@centos8]# systemctl status php-fpm nginx Step 5) Enabling HTTPS/HTTPS [root@centos8]# firewall-cmd --zone=public --permanent --add- service=http [root@centos8]# firewall-cmd --zone=public --permanent --add- service=https [root@centos8]# firewall-cmd –reload
  • 5. Page | 4 Step 6) Configuring and Securing PHP- FPM and Nginx [root@centos8]# nano /etc/php-fpm.d/www.conf Uncomment the following parameters and set their values to the user and group to match the user and group Nginx is running as: listen.owner = nginx listen.group = nginx listen.mode = 066 Step 7) Configuring Timezone [root@centos8]# nano /etc/php.ini
  • 6. Page | 5 date.timezone = Asia/Kuala_Lumpur Step 8) Configuring Pathinfo Change cgi.fix_pathinfo=1 to cgi.fix_pathinfo=0 Step 9) Configuring Security Limit Uncomment security.limit_extensions = .php .php3 .php4 .php5 .php7 inside /etc/php-fpm.d/www.conf file
  • 7. Page | 6 Step 10) Installing Composer & Laravel Framework [root@centos8]# curl -sS https://getcomposer.org/installer | php [root@centos8]# mv composer.phar /usr/local/bin/composer [root@centos8]# chmod +x /usr/local/bin/composer Step 11) Creating Laravel Project [root@centos8]# cd /var/www/html/ [root@centos8]# composer create-project --prefer-dist laravel/laravel <<project_name>>
  • 8. Page | 7 Step 12) Configuring Nginx Server Block for Laravel [root@centos8]# nano /etc/nginx/conf.d/<<project_name>>.conf # copy and paste the following into the <<project_name>>.conf server { listen 80; server_name <<project_name>>.; root /var/www/html/<<project_name>>/public; index index.php; charset utf-8; gzip on; gzip_types text/css application/javascript text/javascript application/x-javascript image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ .php { include fastcgi.conf; fastcgi_split_path_info ^(.+.php)(/.+)$; fastcgi_pass unix:/run/php-fpm/www.sock; } location ~ /.ht { deny all; } }
  • 9. Page | 8 # Save the file and check if the Nginx configuration syntax is correct by running. [root@centos8]#nginx -t [root@centos8]# systemctl restart php-fpm [root@centos8]# systemctl restart nginx
  • 10. Page | 9 Step 13) Update the Security Context [root@centos8#yum -y install policycoreutils-python-utils [root@centos8#semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/<<project_name>>(/.*)?' [root@centos8#semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/<<project_name>>/public(/.*)?' [root@centos8#semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/<<project_name>>/storage(/.*)?' [root@centos8#semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/<<project_name>>/app(/.*)?' [root@centos8#semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/<<project_name>>/bootstrap(/.*)?' [root@centos8#semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/<<project_name>>/config(/.*)?' [root@centos8#semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/<<project_name>>/database(/.*)?' [root@centos8#semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/<<project_name>>/resources(/.*)?' [root@centos8#semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/<<project_name>>/routes(/.*)?' [root@centos8#semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/<<project_name>>/vendor(/.*)?' [root@centos8#semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/<<project_name>>/tests(/.*)?' [root@centos8#restorecon -Rv '/var/www/html/<<project_name>>/'
  • 11. Page | 10 Step 14) Accessing Laravel Website from a Web Browser Type the following command to get the IP address of the current server: [root@centos8#ip ad Create the host name inside the hosts file in /etc/hosts . Next, open a web browser on the local machine and use the following address to navigate. http://<<project_name>>