I am attempting to host a website onto the domain that I purchased from google domains (seanpatnode.com), I have tried several tutorials but I keep getting the same results. Any help would be greatly appreciated! I will give as much information as possible. I am using XAMPP 2.4 as the web server.
Here are relevant lines from my httpd.conf file: (please inform me if I left anything important out.)
ServerRoot "C:/xampp/apache"
Listen 80
ServerName localhost:80
<Directory />
AllowOverride none
Require all denied
</Directory>
# DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
These are the relevant lines from my httpd-vhosts.conf:
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/PhpProject"
ServerName seanpatnode.com
ServerAlias www.seanpatnode.com
<Directory "c:/xampp/htdocs/PhpProject">
AllowOverride All
Require all Granted
</Directory>
</VirtualHost>
These are relevant lines from my hosts file located in: C:\WINDOWS\System32\drivers\etc
127.0.0.1 localhost
127.0.0.1 www.seanpatnode.com
I can see the webpage when I open www.seanpatnode.com from my own computer.
However when I try to open it from another computer it says:
This webpage is not available
The server at www.seanpatnode.com can't
be found, because the DNS lookup failed. DNS is the network service
that translates a website's name to its Internet address. This error
is most often caused by having no connection to the Internet or a
misconfigured network. It can also be caused by an unresponsive DNS
server or a firewall preventing Google Chrome from accessing the
network.
Again, seanpatnode.com is the domain that I purchased from Google Domains. Any help would be greatly appreciated. Thank you.
It's not enough to purchase the domain name, you must also actually put the correct data into it. Specifically in your case, the domain name www.seanpatnode.com does not spring into being by itself, you have to create it and make it point at the IP address of your web server.
Related
I have WAMP up and running, and am trying to restrict access to (1) local and (2) one other IP address. I cant get this to work.
I can only get it to work from either (1) only local or (2) all IPs.
My virtual host conf file Im trying to use:
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
Require ip m.y.i.p
</Directory>
</VirtualHost>
With this, I get a 403 Forbidden page when I try to access from m.y.i.p. I can only access from my localhost.
With the following one Require line, I can access from any IP so I know it is possible:
Require all granted
Is there any way to allow access to localhost and to one or more other IPs? Or do I have something configured wrong?
For posterity, it looks like I found a solution.
Looks like Require Local takes precedence. If I list my local IP range, and my online IP and 127.0.0.1 (three require statements) it works as expected.
Environment
XAMPP 7.2.4 installed on Windows 10
Apache running on ports 80 and 443
Configuration
C:\Windows\System32\drivers\etc\hosts:
127.0.0.1 www.test.local test.local
C:\xampp\apache\conf\httpd.conf:
DocumentRoot "D:/htdocs"
<Directory "D:/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
C:\xampp\apache\conf\extra\httpd-vhosts.conf:
<VirtualHost *:80>
DocumentRoot D:/htdocs
ServerName localhost
<Directory "D:/htdocs">
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot D:/htdocs
ServerName test.local
<Directory "D:/htdocs">
Allow from all
</Directory>
</VirtualHost>
The problem
When I start Apache and I access to localhost is all right. The problem comes when I try to reach test.local: the browser returns a This site can’t be reached message. It's like XAMPP ignores the custom domain vhosts defined into httpd-vhost.conf file. The same message is displayed with the server off.
This site can’t be reached
The webpage at http://test.local/ might be temporarily down or it may have moved permanently to a new web address.
ERR_ADDRESS_INVALID
A few days ago the setup was working and the only changes that I made was the new software installation. I mean, no changes in Apache config files.
If all your stack were working correctly before, don't be like me and don't forget to check if some browser extension is blocking your local traffic, like some extension related with an antivirus system.
In my case it was the Kaspersky Protection extension. When something goes wrong, it shows the following graphic.
C:\Windows\System32\drivers\etc
127.0.0.1 test.local
C:\xampp\apache\conf\extra\httpd-vhosts.conf:
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host2.example.com
DocumentRoot "C:/wamp64/www/test"
ServerName test.local
<Directory "C:/wamp64/www/hydroboost/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
Have you updated your C:\Windows\System32\drivers\etc\hosts file with a mapping like this this?
add this line to the end of the hosts file
127.0.0.1 test.local
the localhost domain works without this mapping, because the OS already recognizes "localhost" as a built in alias for the loopback IP address
(this suggestion is assuming that you are running and testing on the same local machine)
I am working in a php project using wamp. I have these wamp installed in my public server, so till now when I hit 204.XXX.XX.XX/projectname I could access from any computer inside my university. Now I dont want to display this localhost main screen so I tried virtual host configuration.
C:\Windows\System32\drivers\etc\hosts file
I added
204.XXX.XX.XX api.local #api
httpd-vhosts.conf
<VirtualHost *:80>
ServerName api.local
ServerAlias api.local
DocumentRoot "c:/wamp64/www/api"
<Directory "c:/wamp64/www/api/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
I have already enabled the virtual host.
Now from other computer I could not access this api.local project. How can I fix this issue?
THe reason is that the other computer does not know where to find api.local. The browser will look for that domain name in the DNS Server that is registered to be used on the OTHER PC and obviously not find it.
So the other PC needs to know the ip address to go to when you enter api.local. You can do this in a number of ways.
If your Uni techs will allow you to add this domain name to their DNS Server this is the best way.
But if they wont allow this, then you will have to edit the HOSTS file on the OTHER PC like this
204.xxx.xxx.xxx api.local
Now this one PC will know where to find your site. However the HOSTS file is normally well protected and you would need Administrator access to change it, which you admins may not allow.
Another way would be to make the site available on a different port, then you can use the WAMPServer PC ip address and a port number to get to your site like this
Listen 8000
<VirtualHost *:8000>
ServerName api.local
ServerAlias api.local
DocumentRoot "c:/wamp64/www/api"
<Directory "c:/wamp64/www/api/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Now use 204.xxx.xxx.xxx:8000 as the site address and you should get to your site
I want to host multiple websites on my computer. I'm using Windows with WAMP server. I already have domains and know how to map them to ip.
I have already edited httpd.conf file to allow virtual hosts.
My httpd-vhosts file looks like this,
<VirtualHost *:80>
DocumentRoot "C:/wamp64/www"
ServerName localhost
ServerAlias localhost
<Directory "C:/wamp64/www">
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/wamp64/www/testcase"
ServerName test.mydomain.com
<Directory "C:/wamp64/www/testcase">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/wamp64/www/test2"
ServerName test2.mydomain.com
<Directory "C:/wamp64/www/test2">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
The problem is that both my domains open only the first site in this VirtualHost tag.
Example: In this case, both my domains will open the WAMP server configuration page. If I were to move the "testcase" tag above the other, both my domains will open the "testcase" page.
Update:
My subdomains show corresponding pages successfully when I open them on the server. But when I open subdomains on another machine, they open the first entry in the VH.
Update 2: Okay, so this is just out of my understanding now. I thought may be WAMP is not my cup of tea. So I installed XAMPP and made changes to the VH configuration and still ended up with same problem. So I then got rid of XAMPP too and installed WAMPDeveloper Pro. What could go wrong when the software sets up all the configuration files for you, right? But to my surprise, I still have the same problem. The websites work fine when I open them (using actual domain name) on the server itself, but when I open them on machine outside network the first VH entry open for all the domains I open.
Can anyone please help me with this?
Thanks!
Using both Apache2.2 and Apache2.4 syntax gets Apache a litle confused.
So as I assume you are running Apache 2.4 change the VH defs to this
<VirtualHost *:80>
DocumentRoot "C:/wamp64/www/testcase"
ServerName test.mydomain.com
<Directory "C:/wamp64/www/testcase">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/wamp64/www/test2"
ServerName test2.mydomain.com
<Directory "C:/wamp64/www/test2">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Why Apache opens the first site i.e. localhost in this case.
If Apache cannot make sense of a VH def, it ignores it and default to loading the first Virtual Host that was correctly defined in the httpd-vhosts.conf file.
Of course you will also need to amend your c:\windows\system32\driverrs\etc\hosts file to include these domain names
127.0.0.1 localhost
127.0.0.1 test.mydomain.com
127.0.0.1 test2.mydomain.com
::1 localhost
::1 test.mydomain.com
::1 test2.mydomain.com
I am using XAMPP web server.
I have created many virtual hosts.
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "E:/Servers/Server1"
ServerName localhost
</VirtualHost>
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot "E:/Servers/Server2"
ServerName local2
<Directory "E:/Servers/Server2">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
I can acess both websites in my local network as localhost and local2 respectively.
With my external IP, I can only access my first website over Internet.
But my question is, how can I access my all virtual hosts over Internet (though both have same IP), from another computer over different network in WAN?
I didn't find any solution to this.
Is it possible to access over Internet?
If Yes, please explain the detailed procedure.
You can access the second one over the internet as well but for that you will need to add this into the other computer hosts file (located in C:\Windows\System32\drivers\etc):
your internal IP address local2
Example:
192.168.1.65 local2
This is the only way I know at this moment, if there is another solution that does no require to modify the hosts file of the other computer it will be interesting for me as well.