https://www.linode.com/docs/guides/how-to-install-and-use-nginx-on-ubuntu-20-04/
sudo apt update && sudo apt upgrade
sudo apt install nginx
sudo systemctl status nginx
sudo ufw allow http
sudo ufw reload
https://www.rosehosting.com/blog/install-laravel-on-ubuntu-20-04/
apt-get install php8.0 libapache2-mod-php8.0 php8.0-curl php-pear php8.0-gd php8.0-dev php8.0-zip php8.0-mbstring php8.0-mysql php8.0-fpm libapache2-mod-fcgid php8.0-xml curl -y
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
chmod +x /usr/local/bin/composer
composer --version
cd /var/www/
Replace domain.com
to your domain.
composer create-project laravel/laravel domain.com --prefer-dist
cd domain.com
php artisan
chown -R www-data:www-data /var/www/domain.com
chmod -R 777 /var/www/domain.com/storage
sudo nano /etc/nginx/sites-available/domain.com
server {
listen 80;
listen [::]:80;
server_name domain.com;
root /var/www/domain.com/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php index.html;
charset utf-8;
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:/var/run/php/php8.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
sudo ln -s /etc/nginx/sites-available/domain.com /etc/nginx/sites-enabled/
Top comments (0)