I get Access Forbidden (Error 403) when setting up new alias

后端 未结 7 1772
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-13 02:02

I\'m running windows 7 and recently installed XAMPP to build a dev environment. I\'m not great with the server side of things so I\'m having some problems setting up an alia

7条回答
  •  醉梦人生
    2020-12-13 02:18

    Apache 2.4 virtual hosts hack

    1.In http.conf specify the ports , below “Listen”

    Listen 80
    Listen 4000
    Listen 7000
    Listen 9000
    
    1. In httpd-vhosts.conf

      
      ServerAdmin webmaster@dummy-host2.example.com
      DocumentRoot "C:/Users/Vikas/Documents/NetBeansProjects/slider_website_hitesh/public_html"  
      ServerName hitesh_web.dev
      ErrorLog "logs/dummy-host2.example.com-error.log"
      CustomLog "logs/dummy-host2.example.com-access.log" common
      
      
      Allow from all
      Require all granted
      
      
      
      

      this is 2nd virtual host

      
      ServerAdmin webmaster@dummy-host2.example.com
      DocumentRoot "E:/dabkick_git/DabKickWebsite"
      ServerName  www.my_mobile.dev
      ErrorLog "logs/dummy-host2.example.com-error.log"
      CustomLog "logs/dummy-host2.example.com-access.log" common
      
      
       Allow from all
       Require all granted
       
      
      
    2. In hosts.ics file of windows os “C:\Windows\System32\drivers\etc\host.ics”

      127.0.0.1             localhost
      127.0.0.1             hitesh_web.dev
      127.0.0.1             www.my_mobile.dev
      127.0.0.1             demo.multisite.dev
      

    4.now type your “domain names” in the browser it will ping the particular folder specified in the documentRoot path

    5.if you want to access those files in a particular port then replace 80 in httpd-vhosts.conf with port numbers like below and restart apache

       
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "C:/Users/Vikas/Documents/NetBeansProjects/slider_website_hitesh/public_html"
    ServerName hitesh_web.dev
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log" common
    
    
    Allow from all
    Require all granted
    
    
    
    

    this is the 2nd vhost

    
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "E:/dabkick_git/DabKickWebsite"
    ServerName  www.dabkick_mobile.dev
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log" common
    
    
    Allow from all
    Require all granted
    
    
    

    Note: for port number given virtual hosts you have to ping in browser like “http://hitesh_web.dev:4000/” or “http://www.dabkick_mobile.dev:7000/”

    6.After doing all those changes you have to save the files and restart apache respectively.

提交回复
热议问题