Skip to content

Instantly share code, notes, and snippets.

@realtebo
Last active May 2, 2019 07:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save realtebo/a19d87cc870bf8f0e64847ffd127c1bb to your computer and use it in GitHub Desktop.
Save realtebo/a19d87cc870bf8f0e64847ffd127c1bb to your computer and use it in GitHub Desktop.
Step per avviare un progetto laravel + vue
server {
listen 80;
listen 443 ssl http2;
server_name blablabla.local www.blablabla.local;
root /var/www/html/blablabla.com/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
charset utf-8;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
# Questi due parametri sono fondamentali
# per le app Laravel
# => https://serverfault.com/a/927619/178670
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location ~ /\.(?!well-known).* {
deny all;
}
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
ssl_certificate /etc/ssl/certs/localhost.crt;
ssl_certificate_key /etc/ssl/private/localhost.key;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
}
# Aggiornamento di composer
sudo -H composer self-update
# Eventuale installazione di laravel
composer global require laravel/installer
# Aggiungere a .bashrc il path di laravel come
export PATH = $HOME/.config/composer/vendor/bin:$PATH
# Aggiornamento packages globali
composer global update
# Creazione progetto (in questo caso è nella cartella condivisa di una vm)
cd /mnt/hgfs/progetti
laravel new <nome_progetto>
cd <nome_progetto>
npm install
# Creazione link simbolico per la cartella html
cd /var/www/html
sudo ln -s /mnt/hgfs/progetti/nterilizer
# Configurazione nginx
cd /etc/nginx/sites-available/
sudo cp <configurazione_da_copiare> <nuovo_file_di_configurazione>
# editare il file
sudo nano <nuovo_file_di_configurazione>
# Assicurarsi di cambiare i server_name e di togliere il default_server se presente
# Abilitazione nuovo dominio
sudo ln -s ../sites-available/<nuovo_file_di_configurazione>
# Verifica configurazione
sudo nginx -t
# Riavvio webserver
sudo systemctl restart nginx
# Aggiungere al proprio file .hosts il dominio locale appena creato
192.168.<x>.<y> nuovodominiolocale.ext
# Aggiungere un nuovo utente specifico al db (locale) - Scegliere una password FORTE
sudo mariadb
CREATE USER 'blablabla'@'localhost' IDENTIFIED BY 'blablabla@local01'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment