Programing

AllowOverride all을 설정하는 방법

crosscheck 2020. 6. 17. 08:00
반응형

AllowOverride all을 설정하는 방법


설정하고 싶지만 AllowOverride all어떻게해야할지 모르겠습니다. Google을 검색하여 다음 코드를 찾아 붙여 넣었습니다 .htaccess.

<Directory>
        AllowOverride All
</Directory>

그러나 붙여 넣은 후 받기 시작했습니다. "Internal Server Error"

누구 든지이 코드를 어디에 넣을 지 또는 어떻게 수행 할 수 있습니까?


Ubuntu를 사용하는 경우 파일을 편집하십시오 /etc/apache2/apache2.conf(여기서 예제가 있음 /var/www).

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

로 변경하십시오.

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

그때,

sudo service apache2 restart

sudo a2enmod rewrite모듈 재 작성을 활성화 해야 할 수도 있습니다 .


주요 목표는 AllowOverride아파치의 주요 구성 파일 (주로 / etc / apache2 /에있는 파일)의 관리자가 응용 프로그램에 의해 경로별로 동적으로 변경 될 수있는 구성 부분을 결정하는 것입니다.

서버의 관리자가 아닌 경우 이러한 관리자가 허용 하는 AllowOverride 수준 에 의존 합니다. 중요한 보안 설정을 변경하지 못하게 할 수 있습니다.

마스터 아파치 구성 관리자 인 경우 항상 AllowOverride None.htaccess 파일을 기반으로 찾은 모든 google_based 예제를 사용 Directory하여 기본 구성 파일의 섹션으로 전송 해야 합니다. .htaccess파일 의 .htaccess 내용은 HTTP 요청마다 동적 구성 변경이 웹 서버 속도를 늦춘다는 점을 제외하고 /my/path/to/a/directory<Directory /my/path/to/a/directory>명령과 동일 .htaccess합니다. 항상 .htaccess확인 하지 않고 정적 구성을 선호하십시오 ( .htaccess변경으로 인한 보안 공격도 피할 수 있습니다 ).

귀하의 예에서 사용하는 방법 <Directory>은 항상 잘못되며 디렉토리 지침에는 항상 <Directory />또는 <Directory C:>또는 같은 경로가 포함 <Directory /my/path/to/a/directory>됩니다. 물론 이것은로 전환 할 수없는 경우도 있습니다 .htaccessA는 같은 .htaccess디렉토리 명령처럼하지만,이 디렉토리에있는 파일 존재입니다. 물론 당신은 변경할 수 없습니다 AllowOverrideA의 .htaccess이 명령은 관리 될 때 보안 수준.htaccess파일을.


Goto 메모장 your_severpath/apache_ver/conf/에서 파일 httpd.conf을 엽니 다.

이 줄을 찾으십시오.

#LoadModule vhost_alias_module modules / mod_vhost_alias.so

해시 기호를 제거하십시오.

LoadModule vhost_alias_module 모듈 /mod_vhost_alias.so

그런 다음 이동 <Directory />

다음으로 변경하십시오.

<Directory />
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

그런 다음 로컬 서버를 다시 시작하십시오.


Linux에서 문서 루트에 대한 액세스를 완화하려면 다음 파일을 편집해야합니다.

/etc/httpd/conf/httpd.conf

액세스를 완화하려는 디렉토리 레벨에 따라 지시문을 변경해야합니다.

AllowOverride None

AllowOverride All

따라서 / var / www / html 디렉토리의 파일에 대한 액세스를 허용하려면 다음 행을 다음에서 변경해야합니다.

<Directory "/var/www/html">
 AllowOverride None
</Directory>

<Directory "/var/www/html">
 AllowOverride All
</Directory>

Linux를 사용하는 경우 디렉토리에서 코드를 편집 할 수 있습니다.

/etc/httpd/conf/httpd.conf

자, 여기 코드 라인을 찾으십시오.

# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
    AllowOverride None
#
# Controls who can get stuff from this server.
#
    Order allow,deny
    Allow from all

</Directory>

AllowOveride NoneAllowOveride All로 변경

이제 다른 운영 체제가 httpd.conf 파일을 찾아 편집 하려고하면 디렉토리 내의 .httacess 파일에서 모든 종류의 규칙을 설정할 수 있습니다 .


httpd.conf파일 대신 파일 에 설정하고 싶다고 생각 .htaccess합니다.

어떤 OS를 사용하는지 잘 모르겠지만 Ubuntu에 대한이 링크는 수행 할 작업에 대한 몇 가지 지침을 제공 할 수 있습니다.

https://help.ubuntu.com/community/EnablingUseOfApacheHtaccessFiles


As other users explained here about the usage of allowoveride directive, which is used to give permission to .htaccess usage. one thing I want to point out that never use allowoverride all if other users have access to write .htaccess instead use allowoveride as to permit certain modules.

Such as AllowOverride AuthConfig mod_rewrite Instead of

AllowOverride All

Because module like mod_mime can render your server side files as plain text.


I also meet this problem, and I found the solution as 2 step below: 1. In sites-enabled folder of apache2, you edit in Directory element by set "AllowOverride all" (should be "all" not "none") 2. In kohana project in www folder, rename "example.htaccess" to ".htaccess"

I did it on ubuntu. Hope that it will help you.


SuSE Linux Enterprise Server

Make sure you are editing the right file https://www.suse.com/documentation/sles11/book_sle_admin/data/sec_apache2_configuration.html

httpd.conf

The main Apache server configuration file. Avoid changing this file. It primarily contains include statements and global settings. Overwrite global settings in the pertinent configuration files listed here. Change host-specific settings (such as document root) in your virtual host configuration.

In such case vhosts.d/*.conf must be edited

참고URL : https://stackoverflow.com/questions/18740419/how-to-set-allowoverride-all

반응형