http {
...
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 90;
fastcgi_send_timeout 90;
fastcgi_read_timeout 90;
}
Arquivo da categoria: Nginx
Secure Nginx from Clickjacking with X-FRAME-OPTIONS
5 minute upgrade NGINX 1.12 to 1.17+ on CentOS 7 / RHEL 7
Deploy – How to Install Laravel with an Nginx Web Server on Ubuntu 18.04
Install the Backend Components
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install nginx git php7.3-fpm php7.3-mysql php7.3-mcrypt
Modify the PHP Configuration
sudo nano /etc/php/7.3/fpm/php.ini
Mudar a linha que tem:
;cgi.fix_pathinfo=1
para
cgi.fix_pathinfo=0
sudo service php7.3-fpm restart
Configure Nginx and the Web Root
sudo mkdir -p /var/www/laravel
sudo nano /etc/nginx/sites-available/default
Deve ficar assim:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/laravel/public;
index index.php index.html index.htm;
server_name server_domain_or_IP;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Depois sai do arquivo e executa:
sudo service nginx restart
Install Composer and Laravel
cd ~
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
sudo composer create-project laravel/laravel /var/www/laravel
sudo composer create-project laravel/laravel /var/www/laravel 5.8
sudo chown -R :www-data /var/www/laravel
sudo chmod -R 775 /var/www/laravel/storage
http://server_domain_or_IP
Link de referência: https://www.digitalocean.com/community/tutorials/how-to-install-laravel-with-an-nginx-web-server-on-ubuntu-14-04
How to set rails request timeout longer?
worker_timeout (24*60*60) if ENV['RAILS_ENV']=='development'
Nginx reverse proxy causing 504 Gateway Timeout
proxy_read_timeout 10000;
Nginx.conf
upstream puma {
server unix:///home/deploy/apps/exemplo/shared/tmp/sockets/exemplo-puma.sock;
}
server {
listen 80 default_server deferred;
server_name exemplo.com www.exemplo.com;
return 301 https://exemplo.com$request_uri;
}
ssl_certificate /etc/letsencrypt/live/exemplo.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/exemplo.com/privkey.pem;
server {
listen 443 ssl;
server_name exemplo.com;
root /home/deploy/apps/exemplo/current/public;
access_log /home/deploy/apps/exemplo/current/log/nginx.access.log;
error_log /home/deploy/apps/exemplo/current/log/nginx.error.log info;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @puma;
location @puma {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://puma;
}
location /cable {
proxy_pass http://puma;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Forwarded-Proto $scheme;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 10M;
keepalive_timeout 10;
}
Nginx: How do I forward a http request to another port?
location /route {
proxy_pass http://127.0.0.1:9000/;
}
Nginx error SSL_do_handshake() failed while SSL handshaking to upstream
Possíveis configurações no Nginx
events {}
http {
include mime.types;
server {
listen 80;
server_name 167.99.93.26;
root /sites/demo;
# Preferential Prefix match
location ^~ /Greet2 {
return 200 'Hello from NGINX "/greet" location.';
}
# # Exact match
# location = /greet {
# return 200 'Hello from NGINX "/greet" location - EXACT MATCH.';
# }
# # REGEX match - case sensitive
# location ~ /greet[0-9] {
# return 200 'Hello from NGINX "/greet" location - REGEX MATCH.';
# }
# REGEX match - case insensitive
location ~* /greet[0-9] {
return 200 'Hello from NGINX "/greet" location - REGEX MATCH INSENSITIVE.';
}
}
}