marcpaes of TG4 - Infra
5/10/2018 - 3:15 PM

NGINX - PHP

Configuracao do PHP no NGINX

## NGINX PHP
#######################################################
server {
        listen 80 default_server;
        listen [::]:80 default_server;

        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;

        root /var/www/html/tg4.com.br;

        index index.html index.php;

        server_name www.tg4.com.br tg4.com.br;

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

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/run/php/php7.1-fpm.sock;
                fastcgi_index index.php;
                include fastcgi.conf;
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|ico|eot|otf|ttf|woff)$ {
                add_header Access-Control-Allow-Origin *;
                access_log off; log_not_found off; expires 30d;
        }

        location = /robots.txt { access_log off; log_not_found off; }
        location ~ /\. { deny all; access_log off; log_not_found off; }


        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #       deny all;
        #}
}