Skip to content

Instantly share code, notes, and snippets.

@johndavedecano
Last active March 7, 2019 17:39
Show Gist options
  • Save johndavedecano/beaae1140eb76c7a259cb7d388a7f4f5 to your computer and use it in GitHub Desktop.
Save johndavedecano/beaae1140eb76c7a259cb7d388a7f4f5 to your computer and use it in GitHub Desktop.
Setup Laravel on Ubuntu 18.04
https://medium.com/@MicroPyramid/cors-with-amazon-s3-and-cloudfront-2792311c4b46
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<AllowedMethod>DELETE</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>Authorization</AllowedHeader>
</CORSRule>
</CORSConfiguration>
server {
index index.php index.html;
server_name app.tobehired.com default_server;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/tbh-web/public;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
gzip_static on;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/app.tobehired.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/app.tobehired.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = app.tobehired.com) {
return 301 https://$host$request_uri;
}
listen 80 ;
listen [::]:80 ;
server_name app.tobehired.com;
return 404;
}
sudo apt-get update
sudo apt-get install nginx
sudo add-apt-repository ppa:certbot/certbot
sudo apt install python-certbot-nginx
sudo ufw status
sudo certbot --nginx -d example.com
# PHP
sudo apt install php7.2-fpm php7.2-mbstring php7.2-xmlrpc php7.2-soap php7.2-gd php7.2-xml php7.2-cli php7.2-zip php7.2-curl php7.2-mysql unzip
sudo nano /etc/php/7.2/fpm/php.ini
memory_limit = 256M
upload_max_filesize = 64M
cgi.fix_pathinfo=0
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
sudo usermod -a -G www-data $USER
sudo chgrp -R www-data /var/www
sudo chwon -R $USER /var/www
sudo chmod -R 755 /var/www/bootstap/cache
sudo chmod -R 755 /var/www/storage
ssh-keygen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment