Skip to content

Instantly share code, notes, and snippets.

@sangheonhan
Created January 11, 2019 07:09
Show Gist options
  • Save sangheonhan/3af2da049b5d3e46b39cddcc1f15637a to your computer and use it in GitHub Desktop.
Save sangheonhan/3af2da049b5d3e46b39cddcc1f15637a to your computer and use it in GitHub Desktop.
수정 없이 여러 도메인의 사이트를 작업하기 위한 nginx 설정입니다. 간단한 개발이나 테스트 목적으로 만들었습니다.
server {
listen 80;
server_name localhost;
root /home/bookworm/Sites;
index index.php index.html index.htm;
try_files $uri $uri/ /index.php;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(ht|git|svn) {
deny all;
}
}
server {
listen 80;
server_name .local;
if (-d /home/bookworm/Sites/$rootpath/public) {
set $rootpath $rootpath/public;
}
root /home/bookworm/Sites/$rootpath;
index index.php index.html index.htm;
try_files $uri $uri/ /index.php;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
fastcgi_param SERVER_NAME $http_host;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(ht|git|svn) {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment