CentOS
Nginx virtualhost 가상호스트 설정
Crispfeel
2019. 7. 4. 12:23
- 공통으로 사용할 설정을 만들어 줍니다.
- vi /etc/nginx/default.d/default.conf
-- index index.php default.php index.html default.html;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
client_max_body_size 20M;
- 가상호스트를 만들어 줍니다.
- vi /etc/nginx/conf.d/vhost.conf
--server {
listen 80;
server_name abcd.com www.abcd.com;
root /home/abcd/www;
include /etc/nginx/default.d/*.conf;
}
- systemctl restart nginx
전 로그설정이나 오류페이지 설정을 하지 않았지만 필요하신경우는 nginx.conf.default 문서를 참조하여 추가해주시면 됩니다.