Skip to content

Instantly share code, notes, and snippets.

@wesleysaraujo
Forked from wesleyserafim/nginx-default-php
Last active May 18, 2018 21:17
Show Gist options
  • Save wesleysaraujo/1dd50773fb9edd271948cd26371aaffe to your computer and use it in GitHub Desktop.
Save wesleysaraujo/1dd50773fb9edd271948cd26371aaffe to your computer and use it in GitHub Desktop.
Configuração do PHP no Nginx
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
client_max_body_size 20M;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
if (!-d $request_filename) {
rewrite ^/(.+)/$ /$1 permanent;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?$query_string;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_read_timeout 600;
include snippets/fastcgi-php.conf;
# With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment