Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mehdi89/03e9a80f6fc996eccd7ec3b5f875ee43 to your computer and use it in GitHub Desktop.
Save mehdi89/03e9a80f6fc996eccd7ec3b5f875ee43 to your computer and use it in GitHub Desktop.
Deploying simple Laravel Application in AWS with Nginx
sudo apt-get update
sudo add-apt-repository ppa:nginx/stable
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install nginx
sudo apt-get install php7.2 php7.2-mysql php7.2-fpm php7.2-xml php7.2-gd php7.2-opcache php7.2-mbstring
sudo apt install zip unzip php7.2-zip
#composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
sudo composer create-project laravel/laravel tutorial --prefer-dist
sudo chown -R www-data:www-data tutorial/
sudo chmod -R 775 tutorial/
#cd /etc/nginx/sites-available
#sudo nano tutorial.conf
#cd /etc/nginx/sites-enabled
#sudo rm -rf default
#sudo ln -s ../sites-available/tutorial.conf .
#sudo nginx -t
#sudo service nginx restart
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/test/public;
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets);
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
# With php-fpm (or other unix sockets);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment