我與Apache(tips)

最後更新: 2016-11-17

介紹

 


Trouble1:

 

當 service apache2 restart 時見到

Restarting web server: apache2 ... waiting MySQL Connection problem

原來 /etc/apache2/sites-available/ispconfig.conf 內有一句

CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log ........

當 /etc/vlogger-dbi.conf 的 PW 有錯時就出事 ....

 


Trouble2:

 

當 service apache2 restart 時見到

Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

原來 apache 會用 interface 的 IP 去找 RDNS 作為 ServerName

當找不到就出此 warining

解決:

在 /etc/apache2/httpd.conf 加入

ServerName localhost

 


保護 777 Folder

 

建立 .htaccess

<Files ~ "\.(htaccess|htpasswd|ini|bak|old|log|sh|sql|php)$">
    deny from all
</Files>

Options -Indexes

chattr +i .htaccess

 


"Options +Indexes" 失敗

 

在以下設定的 Folder 一直 forbidden

<Files ~ "\.(js|css|html|htm|php)$">
    deny from all
</Files>

Options +Indexes

加入

DirectoryIndex index.cgi

則成功

原因:

當 index.php forbidden 後, autoindex 就不行了.

 


apachectl

 

apachectl is a front end to the Apache HyperText Transfer Protocol (HTTP) server.

It is designed to help the administrator control the functioning of the Apache httpd daemon.

The apachectl script can operate in two modes.

First, it can act as a simple front-end to the httpd command that simply sets any necessary environment variables and

  then invokes httpd, passing through any command line arguments.

Second, apachectl can act as a SysV init script, taking simple one-word arguments

  like start, restart, and stop, and translating them into appropriate signals to httpd.

 


 

Creative Commons license icon Creative Commons license icon