Programming

VirtualHost 추가 실패 : 액세스 금지 오류 403 (XAMPP) (Windows 7)

procodes 2020. 6. 9. 22:35
반응형

VirtualHost 추가 실패 : 액세스 금지 오류 403 (XAMPP) (Windows 7)


Windows 7에서 XAMPP 설치가 실행 중입니다.

httpd-vhosts.conf에 VirtualHost를 추가하자마자 '일반' http://localhost과 새 기능 dropbox.local이 작동하지 않습니다.

이것은 내가 추가 한 것입니다 httpd-vhosts.conf:

<VirtualHost *:80>
    ServerAdmin postmaster@dummy-host.localhost
    DocumentRoot "E:/Documenten/Dropbox/Dropbox/dummy-htdocs"
    ServerName dropbox.local
    ServerAlias www.dropbox.local
    ErrorLog "logs/dropbox.local-error.log"
    CustomLog "logs/dropbox.local-access.log" combined
</VirtualHost>

그래서 나는 dropbox.local-error.log모든 정보를 찾았습니다 .

[Thu Feb 02 10:41:57 2012] [error] [client 127.0.0.1] client denied by server configuration: E:/Documenten/Dropbox/Dropbox/dummy-htdocs/

이 오류는 다음을 추가하여 해결 된 것 같습니다

<directory "E:/Documenten/Dropbox/Dropbox/dummy-htdocs">
     Allow from all
</directory>

그러나 이제이 오류가 발생합니다 dropbox.local-error.log:

[Thu Feb 02 10:45:56 2012] [error] [client ::1] Directory index forbidden by Options directive: E:/Documenten/Dropbox/Dropbox/dummy-htdocs/

또한 액세스하려고 http://localhost하면 일반에 오류가 발생하지 error.log않지만 액세스하려고 하면 오류가 발생하지 않습니다 error 403.

누구든지 도울 수 있습니까? 그것은 나를 미치게합니다 : S

편집 : 또한 httpd.conf다음과 같은 것이 있습니다 (누군가가 말하기 전에 여러 번 언급 한 것을 보았습니다).

<IfModule dir_module>
    DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.html index.htm \
                   default.php default.pl default.cgi default.asp default.shtml default.html default.htm \
                   home.php home.pl home.cgi home.asp home.shtml home.html home.htm
</IfModule>

좋아 : 이것은 내가 지금 한 일이며 해결되었습니다.

httpd-vhosts.conf모습은 다음과 같습니다.

<VirtualHost dropbox.local:80>
    DocumentRoot "E:/Documenten/Dropbox/Dropbox/dummy-htdocs"
    ServerName dropbox.local
    ErrorLog "logs/dropbox.local-error.log"
    CustomLog "logs/dropbox.local-access.log" combined
    <Directory "E:/Documenten/Dropbox/Dropbox/dummy-htdocs">
        # AllowOverride All      # Deprecated
        # Order Allow,Deny       # Deprecated
        # Allow from all         # Deprecated

        # --New way of doing it
        Require all granted    
    </Directory>
</VirtualHost>

먼저 <Directory xx:xx>옵션 을 설정해야한다는 것을 알았습니다 . 그래서 나는 <Directory > [..] </Directory>-part를 INSIDE에 넣었습니다 <VirtualHost > [..] </VirtualHost>. 그 후 옵션에 추가 AllowOverride AuthConfig Indexes했습니다 <Directory>.

이제 http://localhostdropbox-virtualhost도 가리 킵니다. 내가 추가 그래서 dropbox.local하기 <VirtualHost *:80>로 만드는<VirtualHost dropbox.local:80>

드디어 작동 : D!

나는 행복한 사람입니다! :) :)

다른 사람이이 정보를 사용할 수 있기를 바랍니다.


"디렉토리"컨텐츠를 다음과 같이 변경했을 때 저를 위해 일했습니다.

<Directory  "*YourLocation*">
Options All
AllowOverride All
Require all granted  
</Directory>

나에게 (Windows 7의 XAMPP도) 다음과 같이 작동합니다.

<Directory "C:\projects\myfolder\htdocs">`
   AllowOverride All
   Require all granted
   Options Indexes FollowSymLinks
</Directory>` 

403의 원인은 다음과 같습니다.

Order allow,deny

Windows 7에서 XAMPP 1.6.7을 사용하고 있습니다. 이 기사 가 도움이되었습니다.

I added the following lines in the file httpd-vhosts.conf at C:/xampp/apache/conf/extra.
I had also uncommented the line # NameVirtualHost *:80

<VirtualHost mysite.dev:80>
    DocumentRoot "C:/xampp/htdocs/mysite"
    ServerName mysite.dev
    ServerAlias mysite.dev
    <Directory "C:/xampp/htdocs/mysite">
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

After restarting the apache, it were still not working. Then I had to follow the step 9 mentioned in the article by editing the file C:/Windows/System32/drivers/etc/hosts.

# localhost name resolution is handled within DNS itself.
     127.0.0.1       localhost
     ::1             localhost
     127.0.0.1       mysite.dev  

Then I got working http://mysite.dev


Thank you, that worked! But I replaced this

AllowOverride AuthConfig Indexes

with that

AllowOverride All

Otherwise, the .htaccess didn't work: I got problems with the RewriteEngine and the error message "RewriteEngine not allowed here".


Above suggestions didn't worked for me. I got it running on my windows, using inspiration from http://butlerccwebdev.net/support/testingserver/vhosts-setup-win.html

For Http inside httpd-vhosts.conf

<Directory "D:/Projects">       
AllowOverride All
Require all granted
</Directory>

##Letzgrow
<VirtualHost *:80>
DocumentRoot "D:/Projects/letzgrow"
ServerName letz.dev
ServerAlias letz.dev    
</VirtualHost>

For using Https (Open SSL) inside httpd-ssl.conf

<Directory "D:/Projects">       
AllowOverride All
Require all granted
</Directory>

##Letzgrow
<VirtualHost *:443>
DocumentRoot "D:/Projects/letzgrow"
ServerName letz.dev
ServerAlias letz.dev    
</VirtualHost>

Hope it helps someone !!


After so many changes and tries and answers. For

SOs: Windows 7 / Windows 10

Xampp Version: Xampp or Xampp portable 7.1.18 / 7.3.7 (control panel v3.2.4)

Installers: win32-7.1.18-0-VC14-installer / xampp-windows-x64-7.3.7-0-VC15-installer

  1. Do not edit other files like httpd-xampp
  2. Stop Apache
  3. Open httpd-vhosts.conf located in **your_xampp_directory**\apache\conf\extra\ (your XAMPP directory might be by default: C:/xampp/htdocs)
  4. Remove hash before the following line (aprox. line 20): NameVirtualHost *:80 (this might be optional)
  5. Add the following virtual hosts at the end of the file, considering your directories paths:

    ##127.0.0.1
    <VirtualHost *:80>
        DocumentRoot "C:/xampp/htdocs"
        ServerName localhost
        ErrorLog "logs/localhost-error.log"
        CustomLog "logs/localhost-access.log" common
    </VirtualHost>
    
    ##127.0.0.2
    <VirtualHost *:80>
        DocumentRoot "F:/myapp/htdocs/"
        ServerName test1.localhost
        ServerAlias www.test1.localhost
        ErrorLog "logs/myapp-error.log"
        CustomLog "logs/myapp-access.log" common
        <Directory  "F:/myapp/htdocs/">
            #Options All # Deprecated
            #AllowOverride All # Deprecated
            Require all granted  
        </Directory>
    </VirtualHost>
    
  6. Edit (with admin access) your host file (located at Windows\System32\drivers\etc, but with the following tip, only one loopback ip for every domain:

    127.0.0.1 localhost
    127.0.0.2 test1.localhost
    127.0.0.2 www.test1.localhost
    

For every instance, repeat the second block, the first one is the main block only for "default" purposes.


I am using xampp 1.7.3. Using inspiration from here: xampp 1.7.3 upgrade broken virtual hosts access forbidden

INSTEAD OF add <Directory> .. </Directory> in httpd-vhosts.conf, I add it in httpd.conf right after <Directory "D:/xampplite/cgi-bin"> .. </Directory>.

Here is what I add in httpd.conf:

<Directory "D:/CofeeShop">
    AllowOverride All
    Options  All
    Order allow,deny
    Allow from all
</Directory>

And here is what I add in httpd-vhosts.conf

<VirtualHost *:8001>
    ServerAdmin postmaster@dummy-host2.localhost
    DocumentRoot "D:/CofeeShop"
    ServerName localhost:8001
</VirtualHost>

I also add Listen 8001 in httpd.conf to complete my setting.

Hope it helps


For many it's a permission issue, but for me it turns out the error was brought about by a mistake in the form I was trying to submit. To be specific i had accidentally put a "greater than" sign after the value of "action". So I would suggest you take a second look at your code.

참고URL : https://stackoverflow.com/questions/9110179/adding-virtualhost-fails-access-forbidden-error-403-xampp-windows-7

반응형