Synology WebStation の Apache で Autoindex を有効化
ConfigファイルにIndexsオプションを追記する
Include conf-enabled/.webstation.error_page.default.conf <VirtualHost *:9000> DocumentRoot "/volume1/Media" <IfModule dir_module> DirectoryIndex index.html index.htm index.cgi index.php index.php5 </IfModule> <Directory "/volume1/Media"> Options MultiViews FollowSymLinks ExecCGI AllowOverride All <IfModule authz_core_module> Require all granted </IfModule> Options +Indexes # SET INDEX OPTIONS IndexOptions IgnoreCase IndexOptions FancyIndexing IndexOptions FoldersFirst IndexOptions IconHeight=16 IconWidth=16 IndexOptions HTMLTable IndexOptions NameWidth=* IndexOptions DescriptionWidth=* IndexOptions SuppressHTMLPreamble IndexOptions Charset=UTF-8 # SET STYLE SHEET IndexStyleSheet "/.indexstyles/table-darkmode.css" # SET DISPLAY ORDER IndexOrderDefault Ascending Name # SET IGNORE Case IndexIgnore @eaDir .indexstyles IndexIgnore Thumbs.db *.png </Directory> <FilesMatch "\.(php[345]?|phtml)$"> SetHandler "proxy:unix:/run/php-fpm/php-182b445b-6caf-469f-acaa-a763582ba8db.sock|fcgi://localhost" </FilesMatch> </VirtualHost>
参照)スタイル設定はこちらを参考にしました 自定义配置的apache默认目录页 autoindex IndexStyleSheet_你以为你以为的就是你以为的嘛-程序员宝宝 - 程序员宝宝
Synology WebStation の Apache 設定
1)パッケージセンターからApache をインストール
2)WebStation を設定
仮想ホストの設定の、HTTPバックエンドサーバで Apache HTTP Server 2.4 を選択
3)Apacheの設定
httpd.confの位置
/usr/local/etc/apache24/conf/httpd.conf
仮想サーバの httpd.conf の位置
/usr/local/etc/apache24/sites-enabled/httpd-vhost.conf
4)Apache のコマンド
状態取得
sudo systemctl status pkg-apache24.service
再起動
sudo systemctl restart pkg-apache24
※参考 apacheのサービス名確認コマンド
sudo systemctl | grep apache
nginx の autoindex 設定
location / { autoindex on; autoindex_exact_size off; autoindex_format html; autoindex_localtime on; charset utf-8; }
SynologyのWebStation(nginx)のconf設定 永続化
手順
1)/etc/nginx/app.dにあるserver.webstation-vhost.confを開く
2)対象とするserver セクションのincludeパスをメモ
include /usr/local/etc/nginx/conf.d/{ランダム値}/user.conf*;
vi /etc/nginx/app.d/server.webstation-vhost.conf
//例
server { listen ポート default_server; // (省略) include /usr/local/etc/nginx/conf.d/{ランダム値}/user.conf*; }
3)個別の設定ファイルを作成する
次のファイルをrootで作成し、必要な設定を書く
/usr/local/etc/nginx/conf.d/<ランダムな値>/user.conf.{適当な文字列}
//例)ここではuser.conf.arcusを作成
>sudo vi /usr/local/etc/nginx/conf.d/{ランダム値}/user.conf.arcus
location / { try_files $uri $uri/ /index.php?$query_string; } location / { autoindex on; autoindex_exact_size off; autoindex_format html; autoindex_localtime on; }
4)Nginxを再起動
sudo synoservicecfg --restart nginx
nginxのコマンドなど
コマンド
起動
$ sudo service nginx start
再起動$ sudo nginx -s reload
停止nginx -s stop
設定ファイルのチェックnginx -t
設定ファイルの場所
メイン設定ファイルcd /etc/nginx/
仮想サーバ等の設定ファイルcd /etc/nginx/conf.d/