상현에 하루하루
개발자의 하루

WebStation Apache, Nginx conf 설정하기

( 업데이트: )

시놀로지 web station에서 가상 웹서버를 지정할 때 자동적으로 설정 파일들이 생성된다.

Apache

cat /usr/local/etc/apache24/sites-enabled/httpd-vhost.conf 해당경로에 지정한 주소의 커스텀 conf를 등록 할 수 있는 디펙토리를 만들어준다.

기본 conf 설정에 sites-enabled/*.conf 파일을 포함하고있으니 여기서 자신이 커스텀 설정한 conf를 만들어서 사용하면 된다.

설정후

sudo synoservice --restart pkgctl-Apache2.4 # DSM6.*
<meta charset="utf-8">sudo synosystemctl restart <meta charset="utf-8">pkgctl-Apache2.4  # DSM7.*Code language: Bash (bash)

Nginx

cat /etc/nginx/app.d/server.webstation-vhost.conf

해당 파일에 지정한 주소의 커스텀 conf를 등록 할 수 있는 디렉토리를 만들어준다.

wp.hapas.io를 지정한다고 할때

server {

	    listen      80;
	    listen      [::]:80;

	    listen      443 ssl;
	    listen      [::]:443 ssl;

	    server_name wp.hapas.io;

	    ssl_certificate             /usr/local/etc/certificate/WebStation/vhost_74910078-fbe1-4f0a-bd36-bc6f232b32ea/fullchain.pem;
	    ssl_certificate_key         /usr/local/etc/certificate/WebStation/vhost_74910078-fbe1-4f0a-bd36-bc6f232b32ea/privkey.pem;
	    include /usr/syno/etc/security-profile/tls-profile/config/vhost_74910078-fbe1-4f0a-bd36-bc6f232b32ea.conf*;

	    ssl_prefer_server_ciphers   on;

		location ^~ /.well-known/acme-challenge {
			root /var/lib/letsencrypt;
			default_type text/plain;
		}

		root    "/volume1/web/wp.hapas.io";
		index    index.html  index.htm  index.cgi  index.php  index.php5 ;
		error_page 400 401 402 403 404 405 406 407 408 500 501 502 503 504 505 @error_page;

		location @error_page {
			root /var/packages/WebStation/target/error_page;
			rewrite ^ /$status.html break;
		}

		location ^~ /_webstation_/ {
			alias    /var/packages/WebStation/target/error_page/;
		}

		location ~* \.(php[345]?|phtml)$ {
			fastcgi_pass unix:/run/php-fpm/php-e05dd5b6-597c-41a5-a3ad-ff3d65ec7b3a.sock;
			fastcgi_param HOST "wp.hapas.io";
			include fastcgi.conf;
		}

		include /usr/local/etc/nginx/conf.d/74910078-fbe1-4f0a-bd36-bc6f232b32ea/user.conf*;
}
Code language: PHP (php)

위처럼 해당 디렉토리 내부의 conf 파일에 내가 원하는 nginx conf를 설정하면 된다.