computer/linux/apache2
の編集
http://siti.dip.jp/wiki/index.php?computer/linux/apache2
[
トップ
] [
編集
|
差分
|
バックアップ
|
添付
|
リロード
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
|
ログイン
]
-- 雛形とするページ --
bikefriday
books
BracketName
chemical
computer
computer/equation
computer/gromacs
computer/linux
computer/linux/apache2
computer/linux/cluster
computer/linux/emacs
computer/linux/FreeNAS
computer/linux/iptables
computer/linux/networking
computer/linux/ProFTPD
computer/linux/pukiwiki
computer/linux/RaspberryPi
computer/linux/service
computer/linux/torque
computer/programing
computer/programing/Eclipse
computer/programing/Python
computer/programing/python
computer/programing/Python/matplotlib
computer/programing/regular expression
computer/programing/vba
computer/programing/vmd
computer/windows
computer/windows/command prompt
computer/windows/ffmpeg
computer/windows/ImageJ
computer/windows/Inkscape
computer/windows/service
computer/windows/VBA
computer/windows/WebExpression
english
english/mail
english/P.R. response
english/あ
english/か
english/さ
FormattingRules
FrontPage
gnuplot
Help
InterWiki
InterWikiName
InterWikiSandBox
memo
memo/201902
memo/201903
memo/201904
memo/201905
memo/201907
memo/201911
memo/ai
memo/descri
memo/document
memo/life
memo/message
memo/procedure
memo/record
memo/work
memo/引っ越し
MenuBar
microserver
Notebook
PHP
PukiWiki
PukiWiki/1.4
PukiWiki/1.4/Manual
PukiWiki/1.4/Manual/Plugin
PukiWiki/1.4/Manual/Plugin/A-D
PukiWiki/1.4/Manual/Plugin/E-G
PukiWiki/1.4/Manual/Plugin/H-K
PukiWiki/1.4/Manual/Plugin/L-N
PukiWiki/1.4/Manual/Plugin/O-R
PukiWiki/1.4/Manual/Plugin/S-U
PukiWiki/1.4/Manual/Plugin/V-Z
RecentDeleted
SandBox
ST
testable
WikiEngines
WikiName
WikiWikiWeb
work
YukiWiki
[[computer/linux]] *security.conf [#l75d47f0] ''/etc/apache2/conf-available/security.conf'' Only minimal information is displayed in the HTTP reply and error page headers using following setting. #highlighter(PHP){{ # Version information is not displayed in response header. ServerTokens ProductOnly # Apache information is not displayed in error page. ServerSignature Off }} In Apache, the Trace method is enabled by default. If a web application has a cross-site scripting weakness and the Trace method is enabled on the web server, a cross-site tracing weakness may occur. Cross-site tracing weakness may cause leaks of unencrypted Basic authentication ID, passwords, and cookie information. Therefore, it is recommended to disable the Trace method. #highlighter(PHP){{ TraceEnable Off }} *nondisplay of file list(インデックスファイルが存在しない場合にファイル一覧を表示しない) [#wcffe36a] If the index file is not present in the reference directory, the index of folder is shown. /etc/apache2/apache2.conf #highlighter(){{ <Directory /var/www/> # Options Indexes FollowSymLinks Options -Indexes AllowOverride None Require all granted </Directory> }} 多くの解説では、Indexes FollowSymLinks の直前に"-"をつけるとしてあったが、こうすると私の環境ではApacheが起動しない。そこで、"-Indexes"としたところ、問題なく動作するようになった。 ちなみに、.htaccess で設定してしまう方法もあるみたい。 &color(#ff0000){セキュリティに関しては、↓を見ること}; https://makers.shinkosha.net/active/techbox/config/165/ *cgi [#k2aa93ed] ect/apache2/mods-enabledにcgi.loadがあるか確認する。もしなければリンクを作成する。 sudo ln -s /etc/apache2/mods-available/cgi.load /etc/apache2/mods-enabled/cgi.load /etc/apache2/sites-available/000-default.confを編集して、下のIncludeディレクティブがコメントになっていないことを確認する。コメントになっていたらコメントを外す。 Include conf-available/serve-cgi-bin.conf /etc/apache2/conf-available/serve-cgi-bin.confを編集してCGIディレクトリを設定する。 下の例では、CGIディレクトリをデフォルトの/usr/lib/cgi-binから/var/www/cgi-binに変更している。そのままでよいなら変更の必要はない。 <IfModule mod_alias.c> <IfModule mod_cgi.c> Define ENALBLE_USR_LIB_CGI_BIN </IfModule> <IfModule mod_cgid.c> Define ENALBLE_USR_LIB_CGI_BIN </IfModule> <IfDefine ENALBLE_USR_LIB_CGI_BIN> ScriptAlias /cgi-bin/ /var/www/cgi-bin/ <Directory "/var/www/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Require all granted </Directory> </IfDefine> </IfModule> 再起動 次のコマンドを実行してapache2を再起動する。 sudo service apache2 restart https://www.websec-room.com/2014/01/17/1569 http://server-setting.info/debian/apache-install-debian-ubuntu.html http://qiita.com/YasuyukiKawai/items/b32bd94cde7f928c0753 *[[apache2:https://httpd.apache.org/]] [#s7d7b060] Webサーバーのトップとなるドキュメント・ルートのディレクトリは /etc/httpd/conf/httpd.conf にあるDocumentRoot項目で変更する。しかし、Debianの場合httpd.confが存在しない? ここで、 $ grep -r DocumentRoot /etc/apache2 とすると、 /etc/apache2/sites-available/default-ssl.conf: DocumentRoot /var/www/html /etc/apache2/sites-available/000-default.conf: DocumentRoot /var/www/ 両者ともDocumentRootk項目はあるので、 DocumentRoot "/var/www" と変更する。(趣味の問題かもだけどね) ただし、ディレクトリの所有者を変更する必要があるかもしれないので、確認すること。 *ディレクトリリスティングを無効化 [#s06a075f] http://d.hatena.ne.jp/nk87/20110211/1297402776 *BASIC authentication[#uee5e07e] ''/etc/apache2/apache2.conf'' Set the location to restrict viewing and the password file. #highlighter(){{ <Directory /var/www/html/****> AllowOverride None AuthType Basic AuthName Documents AuthBasicProvider file AuthUserFile /etc/******/****/.htpasswd Require valid-user </Directory> }} Preparation of password file. e.g. user: ono password: abcd #highlighter(){{ $ htpasswd -c /etc/******/****/.htpasswd ono New password: ←input password Re-type new password: ←input password Adding password for user ono }} Checking the new password file. You can confirm the new password which is hashed. #highlighter(){{ $ cat /etc/*******/****/.htpasswd ono:******************************** }}
タイムスタンプを変更しない
[[computer/linux]] *security.conf [#l75d47f0] ''/etc/apache2/conf-available/security.conf'' Only minimal information is displayed in the HTTP reply and error page headers using following setting. #highlighter(PHP){{ # Version information is not displayed in response header. ServerTokens ProductOnly # Apache information is not displayed in error page. ServerSignature Off }} In Apache, the Trace method is enabled by default. If a web application has a cross-site scripting weakness and the Trace method is enabled on the web server, a cross-site tracing weakness may occur. Cross-site tracing weakness may cause leaks of unencrypted Basic authentication ID, passwords, and cookie information. Therefore, it is recommended to disable the Trace method. #highlighter(PHP){{ TraceEnable Off }} *nondisplay of file list(インデックスファイルが存在しない場合にファイル一覧を表示しない) [#wcffe36a] If the index file is not present in the reference directory, the index of folder is shown. /etc/apache2/apache2.conf #highlighter(){{ <Directory /var/www/> # Options Indexes FollowSymLinks Options -Indexes AllowOverride None Require all granted </Directory> }} 多くの解説では、Indexes FollowSymLinks の直前に"-"をつけるとしてあったが、こうすると私の環境ではApacheが起動しない。そこで、"-Indexes"としたところ、問題なく動作するようになった。 ちなみに、.htaccess で設定してしまう方法もあるみたい。 &color(#ff0000){セキュリティに関しては、↓を見ること}; https://makers.shinkosha.net/active/techbox/config/165/ *cgi [#k2aa93ed] ect/apache2/mods-enabledにcgi.loadがあるか確認する。もしなければリンクを作成する。 sudo ln -s /etc/apache2/mods-available/cgi.load /etc/apache2/mods-enabled/cgi.load /etc/apache2/sites-available/000-default.confを編集して、下のIncludeディレクティブがコメントになっていないことを確認する。コメントになっていたらコメントを外す。 Include conf-available/serve-cgi-bin.conf /etc/apache2/conf-available/serve-cgi-bin.confを編集してCGIディレクトリを設定する。 下の例では、CGIディレクトリをデフォルトの/usr/lib/cgi-binから/var/www/cgi-binに変更している。そのままでよいなら変更の必要はない。 <IfModule mod_alias.c> <IfModule mod_cgi.c> Define ENALBLE_USR_LIB_CGI_BIN </IfModule> <IfModule mod_cgid.c> Define ENALBLE_USR_LIB_CGI_BIN </IfModule> <IfDefine ENALBLE_USR_LIB_CGI_BIN> ScriptAlias /cgi-bin/ /var/www/cgi-bin/ <Directory "/var/www/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Require all granted </Directory> </IfDefine> </IfModule> 再起動 次のコマンドを実行してapache2を再起動する。 sudo service apache2 restart https://www.websec-room.com/2014/01/17/1569 http://server-setting.info/debian/apache-install-debian-ubuntu.html http://qiita.com/YasuyukiKawai/items/b32bd94cde7f928c0753 *[[apache2:https://httpd.apache.org/]] [#s7d7b060] Webサーバーのトップとなるドキュメント・ルートのディレクトリは /etc/httpd/conf/httpd.conf にあるDocumentRoot項目で変更する。しかし、Debianの場合httpd.confが存在しない? ここで、 $ grep -r DocumentRoot /etc/apache2 とすると、 /etc/apache2/sites-available/default-ssl.conf: DocumentRoot /var/www/html /etc/apache2/sites-available/000-default.conf: DocumentRoot /var/www/ 両者ともDocumentRootk項目はあるので、 DocumentRoot "/var/www" と変更する。(趣味の問題かもだけどね) ただし、ディレクトリの所有者を変更する必要があるかもしれないので、確認すること。 *ディレクトリリスティングを無効化 [#s06a075f] http://d.hatena.ne.jp/nk87/20110211/1297402776 *BASIC authentication[#uee5e07e] ''/etc/apache2/apache2.conf'' Set the location to restrict viewing and the password file. #highlighter(){{ <Directory /var/www/html/****> AllowOverride None AuthType Basic AuthName Documents AuthBasicProvider file AuthUserFile /etc/******/****/.htpasswd Require valid-user </Directory> }} Preparation of password file. e.g. user: ono password: abcd #highlighter(){{ $ htpasswd -c /etc/******/****/.htpasswd ono New password: ←input password Re-type new password: ←input password Adding password for user ono }} Checking the new password file. You can confirm the new password which is hashed. #highlighter(){{ $ cat /etc/*******/****/.htpasswd ono:******************************** }}
テキスト整形のルールを表示する