PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, September 21, 2022

[FIXED] How do you create a virtualhost using a network share?

 September 21, 2022     apache, network-share, virtualhost, wamp, web-hosting     No comments   

Issue

So, I installed WAMP on Windows to run Apache and PHP and I need to create virtualhosts that go to the network share \\10.0.0.177\FMS Studios\Websites. When I go to the domain I get a 403 error. This is what I have in my httpd-vhosts.conf file:

<VirtualHost *:80>
    ServerName tree.fmsds.xyz
    DocumentRoot "\\10.0.0.177\FMS Studios\Websites"
    <Directory  "\\10.0.0.177\FMS Studios\Websites">
        AllowOverride All
        Require all granted
        Order deny,allow
    </Directory>
</VirtualHost>

It does not even register as a virtualhost in WAMP's server manager..

WAMP does not see my virtualhost.

403 Error


Solution

First of all its easier to use forward slashes OR you have to escape all the slashes if you use backslashes

Second you should not mix Apache 2.2 and 2.4 syntax so if you are using an Apache 2.4.x remove the old syntax

<VirtualHost *:80>
    ServerName tree.fmsds.xyz
    DocumentRoot "//10.0.0.177/FMS Studios/Websites"
    <Directory  "//10.0.0.177/FMS Studios/Websites">
        AllowOverride All
        Require all granted
        # remove this as its Apache 2.2 syntax
        #Order deny,allow
    </Directory>
</VirtualHost>

Alternatively using backslashes would look like this

<VirtualHost *:80>
    ServerName tree.fmsds.xyz
    DocumentRoot "\\\\10.0.0.177\\FMS Studios\\Websites"
    <Directory  "\\\\10.0.0.177\\FMS Studios\\Websites">
        AllowOverride All
        Require all granted
        # remove this as its Apache 2.2 syntax
        #Order deny,allow
    </Directory>
</VirtualHost>

Now as its Apache that will require access to the network share you need to be sure that the account that Apache starts under has permissions to access that network share, and that the share is available when the machine is booted and does not need any human intervension.



Answered By - RiggsFolly
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing