SanCi

让PhotoStation支持自定义二级域名
我想我已经找到了通过修改nginx配置文件的方法,让群晖的Photo Station也可以通过独立的二级域名来访问...
扫描右侧二维码阅读全文
11
2018/10

让PhotoStation支持自定义二级域名

我想我已经找到了通过修改nginx配置文件的方法,让群晖的Photo Station也可以通过独立的二级域名来访问

Sanci自建的演示: https://photo.nas.plus

1、在/usr/syno/share/nginx/nginx.mustache中的http内“{{> /usr/syno/share/nginx/DSM}}”(第73行)前增加以下代码:{{> /usr/syno/share/nginx/Photo}}

2、在/usr/syno/share/nginx/下创建Photo.mustache文件,输入以下代码:

server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;

server_name photos.example.com;

location = / {
{{#DSM.ssl}}
if ($scheme = https) {
rewrite / https://$host/photo/ redirect;
}
{{/DSM.ssl}}
rewrite / http://$host/photo/ redirect;
}
include /usr/local/etc/nginx/conf.d/www.PhotoStation.conf;
}

3、添加完成后执行sudo synoservicecfg --restart nginx来重启httpd服务应用这些更改。

怎么样?还算简单吧?也快来试试吧 让B格提升吧


2018-10-20,抽空又折腾了一下
还可以绑定多个域名!
Photo.mustache文件格式:

server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;

server_name `photos1.example.com`;

location = / {
{{#DSM.ssl}}
if ($scheme = https) {
rewrite / https://$host/photo/ redirect;
}
{{/DSM.ssl}}
rewrite / http://$host/photo/ redirect;
}
include /usr/local/etc/nginx/conf.d/www.PhotoStation.conf;
}

server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;

server_name `photos2.example.com`;

location = / {
{{#DSM.ssl}}
if ($scheme = https) {
rewrite / https://$host/photo/ redirect;
}
{{/DSM.ssl}}
rewrite / http://$host/photo/ redirect;
}
include /usr/local/etc/nginx/conf.d/www.PhotoStation.conf;
}

server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;

server_name `photos-n.example.com`;

location = / {
{{#DSM.ssl}}
if ($scheme = https) {
rewrite / https://$host/photo/ redirect;
}
{{/DSM.ssl}}
rewrite / http://$host/photo/ redirect;
}
include /usr/local/etc/nginx/conf.d/www.PhotoStation.conf;
}

该部分仅登录用户可见


随机一言(显示内容与本文关)
Last modification:October 22nd, 2018 at 09:34 am
If you think my article is useful to you, please feel free to appreciate

Leave a Comment