
나는 (이것이 어떻게 작동하는지에 대해 많은 지식을 갖기 전에) 내가 구성한 다소 기본적으로 보이는 VirtualHost 파일을 사용하고 있는데 무엇을 유지해야 할지 정확히 모르겠습니다. 이 모든 항목이 포함된 VM을 설정하는 것은 번거롭고 현재 구성은 프로덕션 환경에 있으므로 시행착오는 실제로 옵션이 아니기 때문에 시도하고 싶지 않습니다. 무고한 사람들을 보호하기 위해 이름이 변경된 파일은 다음과 같습니다.
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName www.my.hostname
ServerAlias my.hostname
DocumentRoot /var/www/mysite
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/mysite>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
CustomLog ${APACHE_LOG_DIR}/access.log combined
LogFormat "%t %T/%D \"%r\" %>s %b" mysitelog
CustomLog ${APACHE_LOG_DIR}/mysite.access.log mysitelog
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
그것에 관한 내 질문은 다음과 같습니다.
블록 을 없애야 할까요
<Directory />
?$APACHE_HOME/conf.d/security
"이것은 현재 일부 웹 애플리케이션 데비안 패키지와 함께 제공되는 구성을 손상시킵니다."라는 설명과 함께 지정됩니다. 이 버전의 주석 처리를 제거하고 가상 호스트에서 해당 버전을 제거해야 합니까?이것은 PHP일 뿐이므로 cgi 블록과 별칭을 유지할 이유가 없다고 생각합니다.
물건도 버릴 수 있을 것 같아요
doc
. 나는 그것이 무엇을 위해 있는지조차 확신하지 못하므로 "정상적인" 설정에서 그것이 무엇을 위해 사용될 것인지 설명할 수 있다면 보너스 포인트(실제로는 아님)가 있습니다.
따라서 내가 생각하는 모든 것이 옳다고 가정하면 새 vhost 파일은 다음과 같을 수 있습니다.
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName www.my.hostname
ServerAlias my.hostname
DocumentRoot /var/www/mysite
<Directory /var/www/mysite>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
CustomLog ${APACHE_LOG_DIR}/access.log combined
LogFormat "%t %T/%D \"%r\" %>s %b" mysitelog
CustomLog ${APACHE_LOG_DIR}/mysite.access.log mysitelog
</VirtualHost>
다른 조언도 환영합니다. 감사해요! 내 구성에서 추가 정보가 필요한 경우 알려주시기 바랍니다!
답변1
블록 을 없애야 할까요
<Directory />
?
확신하는! 이는 가상 호스트가 아닌 서버 수준에서 처리할 수 있는 일입니다.
이것은 PHP일 뿐이므로 cgi 블록과 별칭을 유지할 이유가 없다고 생각합니다.
핵무기를 발사하세요.
문서 관련 내용도 제거할 수 있을 것 같아요.
핵무기를 발사하세요. 새로 설치된 웹 서버를 사용하여 시스템 문서를 찾아볼 수 있도록 여기에 있습니다. 이것은 귀여운 예이지만 제 생각에는 실제로 기본 구성 파일에 속하지 않습니다.
제안된 구성 파일에서: 좋아 보입니다! 제가 드릴 수 있는 한 가지 권장 사항은 파일을 사용하지 않는 경우 AllowOverride All
디렉터리 블록의 를 로 변경하는 것입니다 . 파일을 사용하는 경우 해당 파일을 누킹하고 해당 구성을 디렉터리 블록으로 가져오는 것이 좋습니다. (AllowOverride None
.htaccess
.htaccess
내가 왜 그렇게 말하는지에 대한 자세한 내용은 여기를 참조하세요.)