-
-
Save panbanda/17cfe568d9ea8cdebd46 to your computer and use it in GitHub Desktop.
Nginx / Apache + PHP Installation on EC2 Instance
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 linux update, followed by GCC and Make | |
sudo yum -y update | |
sudo yum install -y gcc make | |
# Install Nginx and PHP-FPM | |
sudo yum install -y nginx php-fpm | |
# Install PHP extensions | |
sudo yum install -y php-devel php-mysql php-pdo \ | |
php-pear php-mbstring php-cli php-odbc \ | |
php-imap php-gd php-xml php-soap | |
# Install PHP-APC | |
sudo yum install -y php-pecl-apc | |
sudo yum install -y pcre-devel | |
# Install MySQL | |
sudo yum -y install mysql-server mysql | |
# Nginx Configuration | |
sudo nano /etc/nginx/conf.d/default.conf | |
# PHP-FPM Configuration | |
sudo nano /etc/php-fpm.d/www.conf | |
# Autostart Nginx, PHP-FPM and MySQL | |
sudo chkconfig nginx on | |
sudo chkconfig mysqld on | |
sudo chkconfig php-fpm on |
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 linux update, followed by GCC and Make | |
sudo yum -y update | |
sudo yum install -y gcc make | |
# Install PHP extensions | |
sudo yum install -y php-devel php-mysql php-pdo \ | |
php-pear php-mbstring php-cli php-odbc \ | |
php-imap php-gd php-xml php-soap | |
# Install PHP-APC | |
sudo yum install -y php-pecl-apc | |
sudo yum install -y pcre-devel | |
# Install MySQL | |
sudo yum -y install mysql-server mysql | |
# Nginx Configuration | |
sudo nano /etc/httpd/conf/httpd.conf | |
# Autostart Nginx, PHP-FPM and MySQL | |
sudo chkconfig httpd on | |
sudo chkconfig mysqld on |
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
location / { | |
root /var/www/html; | |
index index.php index.html index.htm; | |
} | |
location ~ \.php$ { | |
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name; | |
include fastcgi_params; | |
} |
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
[...] | |
;listen = 127.0.0.1:9000 | |
listen = /var/run/php-fpm/php-fpm.sock | |
;listen.owner = nobody | |
listen.owner = nginx | |
;listen.group = nobody | |
listen.group = nginx | |
;listen.mode = 0666 | |
listen.mode = 0664 | |
user = nginx | |
group = nginx | |
[...] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment