Skip to content

Instantly share code, notes, and snippets.

@lazyjerry
Created September 17, 2017 04:43
Show Gist options
  • Save lazyjerry/90ded5ee248f49b7323247afa9a2fd7e to your computer and use it in GitHub Desktop.
Save lazyjerry/90ded5ee248f49b7323247afa9a2fd7e to your computer and use it in GitHub Desktop.
目前設定只有80 port的、php 7.1
server {
listen 80;
listen [::]:80;
server_name {{Server 名稱}};
access_log {{Log 路徑}}access.log;
error_log {{Log 路徑}}error.log;
root {{Server 路徑}};
index index.php index.html index.htm;
location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
expires max;
log_not_found off;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
try_files $uri =404;
#注意這裡是使用php7.1
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
#設定 CI 的開發或是產品模式
fastcgi_param CI_ENV 'production';
include fastcgi_params;
}
location ~ /\.ht { deny all; }
location ~* \.(svn|git|bak|bk|old|save|swp)$ { deny all; }
location ~ /\.(svn|git|.DS_Store|.gitignore) { deny all; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment