Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
  1. Instalacion nginx
sudo apt install nginx
sudo systemctl stop nginx.service
sudo systemctl start nginx.service
sudo systemctl enable nginx.service
sudo systemctl status nginx.service
  1. Instalación PHP, composer y PostgreSQL (Ya esta realizado)
sudo apt install php7.3 libapache2-mod-php7.3 php7.3-cli php7.3-mysql php7.3-gd php7.3-imagick php7.3-recode php7.3-tidy php7.3-xmlrpc
sudo systemctl enable php7.3-fpm
sudo systemctl start php7.3-fpm
sudo systemctl status php7.3-fpm
  1. Editar variable en php.ini (Depende de la versión de PHP, para el caso PHP7.3)
vim /etc/php/7.3/fpm/php.ini

Variables a modificar y habilitar si estan comentados

memory_limit = 256M
upload_max_filesize = 64M
cgi.fix_pathinfo=0
  1. Configuración de la aplicacion laravel

La carpeta comparaimagenes debe estar en la ruta /var/www/html/

chown -R www-data:www-data /var/www/html/comparaimagenes/
chmod -R 755 /var/www/html/comparaimagenes/

cd /var/www/html/comparaimagenes/
chown -R www-data:www-data public/
chmod -R 777 storage/
chmod -R 777 storage/logs/laravel.log
php artisan key:generate
php artisan cache:clear
php artisan config:cache
  1. Configuración de nginx-laravel
vim /etc/nginx/sites-available/laravel
server {
    listen 8080;
    listen [::]:8080;
    root /var/www/html/comparaimagenes/public;
    index  index.php index.html index.htm;
    server_name  example.com;

    location / {
        try_files $uri $uri/ /index.php?$query_string;        
    }

    location ~ \.php$ {
         try_files $uri =404;
         fastcgi_split_path_info  ^(.+\.php)(/.+)$;
         fastcgi_index            index.php;
         fastcgi_pass             unix:/var/run/php/php7.3-fpm.sock;
         include                  fastcgi_params;
         fastcgi_param   PATH_INFO       $fastcgi_path_info;
         fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

Dependiendo de la versión y ubicación, la variable fastcgi_pass podria modificarse, para el caso se esta usando PHP7.3

  1. Habilitar Laravel
sudo ln -s /etc/nginx/sites-available/laravel /etc/nginx/sites-enabled/
  1. Reiniciar nginx
sudo systemctl restart nginx.service
  1. Validar
http://localhost:8080 o http://127.0.0.1:8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment