Last active
February 26, 2020 01:28
-
-
Save ansulev/b886d8ae84823e2fd3cd9e7e7a95149d to your computer and use it in GitHub Desktop.
Install Nginx and PHP7-FPM on AWS with RHEL7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Install and configuration Nginx, PHP7-FPM on AWS with RHEL7 | |
# | |
# Install REMI and EPEL repos | |
rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm | |
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm | |
# Install PHP and Nginx | |
yum --enablerepo=remi,remi-php70 install nginx php-fpm php-common | |
# Install PHP molules | |
yum --enablerepo=remi,remi-php70 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 | |
# Enable Nginx on boot and start it | |
systemctl enable nginx.service && systemctl start nginx.service | |
# The same with PHP-FPM | |
systemctl enable php-fpm.service && systemctl start php-fpm.service | |
#Install and enable fail2ban | |
yum install fail2ban | |
systemctl enable fail2ban.service && systemctl start fail2ban.service | |
# Install some basic tools | |
yum install vim nano mlocate htop | |
# Create virtual host public_html directory and logs directory | |
mkdir -p /srv/www/testsite.local/public_html | |
mkdir /srv/www/testsite.local/logs | |
chown -R apache:apache /srv/www/testsite.local | |
# Create and configure virtual host directories under /etc/nginx | |
mkdir /etc/nginx/sites-available | |
mkdir /etc/nginx/sites-enabled | |
#Add following lines to /etc/nginx/nginx.conf file, inside http block. | |
## Load virtual host conf files. ## | |
include /etc/nginx/sites-enabled/*; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment