win 10 apache 2.4 how to setup local hosts

dmreed

New Member
I have searched the web quite a bit and have not found an answer to my need:

I am running Win 10 Pro 64x. I have two directories which I need to access as local hosts: g:/8081dmreed and g:/8082devsite.

Can someone please provide me exact coding regarding the Windows hosts file and the Apache files httpd.conf, httpd-vhosts.conf, and any additional files.
 
Hi dmreed,

Are you sure you're editing the correct hosts file? This article makes it look like it depends on the application you'll be using, Apache in your case I'm thinking. So if you are using a 64 bit of Apache the file is at %Windir%\System32\drivers\etc if 32 bit then it's at %Windir%\Sysnative\drivers\etc.

Another thing to point out that I am sure you're not doing is including the 'dmreed' or 'devsite' in the vhost on the port number. Port numbers don't have alphas and I'm sure you're not putting it in there but thought I'd mention it.

Next is do make sure that you have a vhost created for the localhost that points to your XAMP installation. But additionally since your directories are not inside your documentroot.

For reference here's where I found information on setting up a vhost on Windows.

It would also help if you showed us your edited sections of your files and also what is in the Apache error log when you try to access your sites.

Hope that helps and let us know if you get it!
 
Hi dmreed,

Are you sure you're editing the correct hosts file? This article makes it look like it depends on the application you'll be using, Apache in your case I'm thinking. So if you are using a 64 bit of Apache the file is at %Windir%\System32\drivers\etc if 32 bit then it's at %Windir%\Sysnative\drivers\etc.

Another thing to point out that I am sure you're not doing is including the 'dmreed' or 'devsite' in the vhost on the port number. Port numbers don't have alphas and I'm sure you're not putting it in there but thought I'd mention it.

Next is do make sure that you have a vhost created for the localhost that points to your XAMP installation. But additionally since your directories are not inside your documentroot.

For reference here's where I found information on setting up a vhost on Windows.

It would also help if you showed us your edited sections of your files and also what is in the Apache error log when you try to access your sites.

Hope that helps and let us know if you get it!


dmreed:

the link you provided is for Win 7, my understanding is that Win 10 is different especially regarding port 80.

the following are my current settings based upon several different descriptions of what is required for Win 10 using Apache 2.4.

again I am using Win 10 Pro 64x, XAMPP 7.0.9, directory used is g:/xampp, and desired local host directories g:8081dmreed, and g:/8082devsite.

C:\Windows\System32\drivers\etc\hosts:

127.0.0.1 localhost
::1 localhost
127.0.0.1 localhost
127.0.0.1 8081dmreed.local
127.0.0.1 8082devsite.local

G:\xampp\apache\conf\httpd.conf:

ServerRoot "G:/xampp/apache"

Listen 127.0.0.1
Listen 8081
Listen 8082

# Virtual hosts
Include conf/extra/httpd-vhosts.con

G:\xampp\apache\conf\extra\httpd-vhosts.conf:

<Directory "g:\8081dmreed">
Order Deny,Allow
Allow from all
</Directory>
<Directory "g:\8082devsite">
Order Deny,Allow
Allow from all
</Directory>
# Use name-based virtual hosting.
#
NameVirtualHost 127.0.0.1
#

<VirtualHost 127.0.0.1>
DocumentRoot "G:/8081dmreed"
ServerName 8081dmreed.local
</VirtualHost>

<VirtualHost 127.0.0.1>
DocumentRoot "G:/8082devsite"
ServerName 8082devsite.local
</VirtualHost>

no error log messages but this displays in the XAMPP control panel:

11:05:37 AM [Apache] Attempting to start Apache app...


11:05:37 AM [Apache] Status change detected: running


11:05:38 AM [Apache] Status change detected: stopped


11:05:38 AM [Apache] Error: Apache shutdown unexpectedly.

11:05:38 AM [Apache] This may be due to a blocked port, missing dependencies,

11:05:38 AM [Apache] improper privileges, a crash, or a shutdown by another method.

11:05:38 AM [Apache] Press the Logs button to view error logs and check

11:05:38 AM [Apache] the Windows Event Viewer for more clues

11:05:38 AM [Apache] If you need more help, copy and post this

11:05:38 AM [Apache] entire log window on the forums

rather than trying to described what I might be doing incorrectly, maybe someone can simply show me what should be in the hosts, httpd.conf and httpd-vhosts.conf files.
 
maybe someone who is actually running Win 10 Apache 2.4.23 with local hosts similar to mine can provide appropriate code???
 
Top