자동완성

일반 PHP 사이트

일반적인 PHP 사이트 (그누보드 등)

 
server {
    listen       80;
    server_name  samplesite.com www.samplesite.com anothersite.net;
    root   /home/myuser1/www;

    #set same size as post_max_size(php.ini or php_admin_value).
    client_max_body_size 10M;

    access_log /var/log/nginx/samplesite.com.access.log main;
    error_log  /var/log/nginx/samplesite.com.error.log warn;
 
    location / {
        index  index.php index.html;
    }
 
    # Allow Lets Encrypt Domain Validation Program
    location ^~ /.well-known/acme-challenge/ {
        allow all;
    }
 
    # Block dot file (.htaccess .htpasswd .svn .git .env and so on.)
    location ~ /\. {
        deny all;
    }
 
    # Block (log file, binary, certificate, shell script, sql dump file) access.
    location ~* \.(log|binary|pem|enc|crt|conf|cnf|sql|sh|key)$ {
        deny all;
    }
 
    # Block access
    location ~* (composer\.json|composer\.lock|composer\.phar|contributing\.md|license\.txt|readme\.rst|readme\.md|readme\.txt|copyright|artisan|gulpfile\.js|package\.json|phpunit\.xml)$ {
        deny all;
    }
 
    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }
 
    location = /robots.txt {
        log_not_found off;
        access_log off;
    }
 
    # Block .php file inside upload folder. uploads(wp), files(drupal), data(gnuboard).
    location ~* /(?:uploads|default/files|data)/.*\.php$ {
        deny all;
    }
 
    # Add PHP handler
    location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        if (!-f $document_root$fastcgi_script_name) {
            return 404;
        }
 
        fastcgi_pass unix:/var/run/php-fpm/myuser1.sock;
        fastcgi_index index.php;
        fastcgi_buffers 64 4k; # default 8 4k

        include fastcgi_params;
    }
}