일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- SKT
- 소비전력
- 티스토리
- mysql
- KB증권
- php
- 자바스크립트
- Apache
- 리눅스
- 보르비스초월
- 복현오거리
- centos
- jQuery
- ConoHa
- PHP-FPM
- 알뜰폰
- iptime
- 시놀로지
- 아파치
- 램가스초월
- nginx
- Rocky
- 킹북이초월
- 스톤에이지
- 알리익스프레스
- 윈도우10
- 가상서버호스팅
- OpenWrt
- proxmox
- KB국민카드
- Today
- Total
맛집 여행 캠핑 일상 생활
[시놀로지] DSM 7.1.1 WebStation index.html php 실행 본문
Synology DSM 6.x 버전과 DSM 7.x 버전이 설정 경로가 다르군요~
WebStation 에서 가상호스트를 추가해서 테스트 하는데 index.html 에 있는 php 코드가 실행이 안되네요~
apache, nginx 둘다 안됩니다.
디폴트로 .html 도 작동하도록 해주면 좋겠지만 설정할때 마다 추가 설정을 해줘야 하네요~
backend apache2.4 인 경우
# find / -name httpd-vhost.conf
/usr/local/etc/apache24/sites-enabled/httpd-vhost.conf
find 명령어로 httpd-vhost.conf 파일을 찾습니다.
# cat /usr/local/etc/apache24/sites-enabled/httpd-vhost.conf
Include conf-enabled/.webstation.error_page.default.conf
<VirtualHost *:8000>
DocumentRoot "/volume1/web/example/www"
<IfModule dir_module>
DirectoryIndex index.html index.htm index.cgi index.php index.php5
</IfModule>
<Directory "/volume1/web/example/www">
Options MultiViews FollowSymLinks ExecCGI
AllowOverride All
<IfModule authz_core_module>
Require all granted
</IfModule>
</Directory>
<FilesMatch "\.(php[345]?|phtml)$">
SetHandler "proxy:unix:/run/php-fpm/php-a4493968-9c9a-9edb-b0d1-928319a24a69.sock|fcgi://php-a4493968-9c9a-9edb-b0d1-928319a24a69"
</FilesMatch>
</VirtualHost>
FilesMatch 부분에서 html 이 없는데 추가해주어야 하는데 위 파일은 자동으로 생성되는 파일이므로 다른 경로에 따로 만들어 주어야합니다.
# vi /usr/local/etc/apache24/sites-enabled/example.conf
<FilesMatch "\.(php[345]?|phtml|html)$">
SetHandler "proxy:unix:/run/php-fpm/php-a4493968-9c9a-9edb-b0d1-928319a24a69.sock|fcgi://php-a4493968-9c9a-9edb-b0d1-928319a24a69"
</FilesMatch>
backend nginx 인 경우
# find / -name server.webstation-vhost.conf
/usr/local/etc/nginx/sites-enabled/server.webstation-vhost.conf
# cat /usr/local/etc/nginx/sites-enabled/server.webstation-vhost.conf
server {
listen 8000 ssl default_server;
listen [::]:8000 ssl default_server;
server_name _;
include /usr/syno/etc/www/certificate/WebStation_vhost_e2fd939c-64cd-4bba-bbba-5beb0db61cc8/cert.conf*;
include /usr/syno/etc/security-profile/tls-profile/config/vhost_e2fd939c-64cd-4bba-bbba-5beb0db61cc8.conf*;
ssl_prefer_server_ciphers on;
include conf.d/.webstation.error_page.default.conf*;
include conf.d/.webstation.error_page.default.resource.conf*;
root "/volume1/web/example/www";
index index.html index.htm index.cgi index.php index.php5 ;
location ~* \.(php[345]?|phtml)$ {
fastcgi_pass unix:/run/php-fpm/php-a4493968-9c9a-9edb-b0d1-928319a24a69.sock;
fastcgi_connect_timeout 60s;
fastcgi_read_timeout 60s;
fastcgi_send_timeout 60s;
include fastcgi.conf;
}
include /usr/local/etc/nginx/conf.d/e2fd939c-64cd-4bba-bbba-5beb0db61cc8/user.conf*;
}
nginx 설정도 역시나 html 부분이 없습니다.
location 부분을 복사해서 html 을 추가해서 위에 보이는 include /usr/local/etc/nginx/conf.d/e2fd939c-64cd-4bba-bbba-5beb0db61cc8/user.conf* 에 해당되도록 파일을 만들어줍니다.
# vi /usr/local/etc/nginx/conf.d/e2fd939c-64cd-4bba-bbba-5beb0db61cc8/user.conf-html
location ~* \.(php[345]?|phtml|html)$ {
fastcgi_pass unix:/run/php-fpm/php-a4493968-9c9a-9edb-b0d1-928319a24a69.sock;
fastcgi_connect_timeout 60s;
fastcgi_read_timeout 60s;
fastcgi_send_timeout 60s;
include fastcgi.conf;
}
php-fpm 설정
find 명령어로 fpm.conf 파일을 찾아서 해당 파일을 수정합니다.
/usr/syno/etc/packages/WebStation/php_profile
/volume1/@appconf/WebStation/php_profile
두 폴더는 심볼릭링크
# vi /volume1/@appconf/WebStation/php_profile/a4493968-9c9a-9edb-b0d1-928319a24a69/fpm.conf
[global]
pid = /run/php-fpm/php-a4493968-9c9a-9edb-b0d1-928319a24a69.pid
error_log=syslog
syslog.facility = daemon
syslog.ident = php80-fpm
log_level = warning
daemonize = no
[www]
user = http
group = http
listen = /run/php-fpm/php-a4493968-9c9a-9edb-b0d1-928319a24a69.sock
listen.owner = http
listen.group = http
listen.mode = 0660
pm = dynamic
pm.max_children = 20
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
security.limit_extensions = .php .php3 .php4 .php5 .phtml .html
security.limit_extensions = .php .php3 .php4 .php5 .phtml 부분을 찾아서 .html 을 추가합니다.
이 파일은 Web Station 에서 스크립트 언어 설정 항목을 수정하면 다시 초기화 됩니다.
설정을 변경했다면 항상 확인하셔야 합니다.
이제 backend 를 nginx apache 번갈아 가면서 확인하면 됩니다.
'Synology' 카테고리의 다른 글
[Synology] 시놀로지 unzip 명령어 (0) | 2025.02.12 |
---|---|
[Synology] 시놀로지 NAS 개인 계정별 폴더 권한 (0) | 2024.10.24 |