I know that this is a duplicate, but all the other answers I read didn't work for me.
I want to create sub domains for my Apache web server, I want to either be able to access it by one of the following. I just found out that the only people who can access the website are users on my network, do you know why?
sub.domain.com
sub.localhost
sub.000.00.00.00 (Hidden for security)
sub.127.0.0.1
I tried editing the vhost.config file and manage to break Xampp. I am reinstalling it as I type this.
Also is it possible to host multiple websites on a single server? Please explain to me all of this, I been playing around with Xampp and Goggling for too long now.
The error I am getting is the server isn't responding to sub.localhost, but it is for localhost.
httpd-vhost.config
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/site1"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/site2"
ServerName sub.localhost
</VirtualHost>
errors.log
Related
Earlier today I successfully connected to my Apache server both via http:/localhost and IP address. I turned off the server briefly and when I ran it again, I was only able to connect via IP (which connects successfully from my computer as well as others in the network).
I checked to make sure that my ServerRoot and DocumentRoot were C:/Apache24 and ${SRVROOT}/htdocs respectively as well as that all my server-related files were in htdocs. Additionally, I verified this issue on both Chrome and Firefox (where I also tried clearing the cache).
Any suggestions regarding how to fix this would be greatly appreciated.
Here are the lines I referenced in my httpd.conf file (spliced together):
Define SRVROOT "C:/Apache24"
ServerRoot "${SRVROOT}"
DocumentRoot "${SRVROOT}/htdocs"
<Directory "${SRVROOT}/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
I would be happy to elaborate on any pertinent information I may have neglected
By setting the "Listen" setting to a specific IP address and port as opposed to a port, I stopped my computer from accessing the site via localhost. By updating the httpd.conf file to read "Listen 80" I resolved this issue.
I am trying to host two sites on apache 2.4 server which is running in windows 2012 server. I have added vhost entries for two sites one running on 80 and other on 8080.
Sample vhost entries:
<VirtualHost *:80>
DocumentRoot "/www/example1"
ServerName www.example.com
</VirtualHost>
<VirtualHost *:8080>
DocumentRoot "/www/example2"
ServerName www.example2.com
</VirtualHost>
With this configuration both the domain points to site running on port 8080. Considering above sample, sites opens same code in directory /www/example1 on both www.example.com and www.example2.com domains.
But if I access site with I.P. like http://198.21.22.1:80 and http://198.21.22.1:8080 the sites work fine but through domains it does not.
We have a load balancer in between which point to the actual server.
Need to know what configurations or setting if any I have missed.
I have added Listen entries for 80 and 8080 in httpd.conf file.
UPDATE
On further analysis I found that, from different systems different version of site opens up. Example, from my system both the domain opens up code running from /www/example1, but from my mobile client it opens up code running from /www/example2 for both domains.
So, I checked from some other system and found that it opens code running from /www/example1 for both domains and again from some other system it opens up code running from /www/example2 for both domains.
We have a load balancer in between which redirects to the http server on which /www/example1 and /www/example2 are present. Currently I do not have access to this load balancer, but can load balancer be cause of this issue?
Thanks,
Uday
I just added virtualhost entries with same port 80 for both sites with different servername.
Issue was with tow systems being present had to make changes on both server in the load balance cluster.
I'm having troubles with setting a vhost with vagrant.
I've configured my host file on my host (192.168.33.10 local.dev). Yet I don't know how to set up my vhost within my VM and how to access it. And I don't want to use puppet or chef or other as I want to understand what I'm doing... :)
At the moment here are my settings of my vhost:
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/support/mysite
<Directory /var/www/html/support/mysite>
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/mysite-error.log
CustomLog ${APACHE_LOG_DIR}/mysite-access.log combined
The problem is I don't really know what I should put as server name or alias and how to access it then.
Thanks for any help !!!
If you already added all the sites you want to run as virtual ones on your host file (all with same IP), then all you need to do is add multiple "VirtualHost" configurations to your apache conf file and use the same "site.dev" name you defined. Apache will read that and direct to the correct "DocumentRoot".
Here is a snippet with two sites defined. Just add more definitions for more sites:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/site1/
ErrorLog logs/site1_error_log
CustomLog logs/site1_access_log combined
ServerName site1.dev
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/site2/
ErrorLog logs/site2_error_log
CustomLog logs/site2_access_log combined
ServerName site2.dev
</VirtualHost>
You don't need a vhost as long as you are serving only one site per machine - local.dev in this case. You can leave the default apache2 configuration.
You need to understand what virtual hosting is actually for to see this:
The main purpose of virtual hosting is the possibility to run multiple web sites with different DNS domain names on one single machine having only one public IP address assigned to it. While there are many websites which would never exhaust the physical power of a server because of their low traffic, the most obvious advantage is that the number of available domains is now independent from the number of available IP (v4) addresses, which is very limited.
This is being achieved by a change in HTTP which was launched in version 1.1. The change adds the Host header to the HTTP request which contains the servers domain name. A HTTP server normally would not have this information: "What was the hostname used by the client to access me", as the DNS resolution will happen before the client issues the HTTP request and the server will then being accessed by it's IP address.
Having the information from the Host header, the server, while being accessed by it's IP address, can decide which site should being served. Multiple sites will then have different document root folders for that.
However, you are serving just a single page from your vagrant box, therefore setting up a virtual host isn't required. Just use apache's default one.
I think there is a more elegant solution to the issue of VHosts on your Vagrant Box.
Set your Virtual hosts directly in your Vagrant file so your configuration can commit to git.
Check out the instructions Setting VHosts in the Vagrantfile here:
https://github.com/onema/vagrant-lamp-development#creating-custom-vhosts
Docs on Chef Solo Here
https://docs.chef.io/chef_solo.html
i have an application which is deployed on websphere application server with ibm http server.I want to change the domain name.I have figured out that changes will be required in httpd.conf file. in the servername tag.also plugin-cfg.xml needs to be changed.How should i modify these files.and how will the changes be reflected.
And are there any other files/properties files where i have to chnage the domain name.
Thanks
You don't want to edit plugin-cfg.xml manually (except in very rare cases). The hostnames in there come from the Aliases defined for the WebSphere Virtual Hosts.
By default, those usually have *:80, so changing the server domain name would require no changes at all. For instance:
<VirtualHostGroup Name="default_host">
<VirtualHost Name="*:9080"/>
<VirtualHost Name="*:80"/>
<VirtualHost Name="*:9443"/>
<VirtualHost Name="*:5060"/>
<VirtualHost Name="*:5061"/>
<VirtualHost Name="*:443"/>
</VirtualHostGroup>
If the WebSphere Virtual Host that your application is using does specify an Alias with a particular domain name, you just change the domain name there.
I've setup Apache do create some virtual hosts. Specifically, I've added the following to my httpd.conf:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName example1.foo
DocumentRoot /www/example1
</VirtualHost>
<VirtualHost *:80>
ServerName example2.foo
DocumentRoot /www/example2
</VirtualHost>
This was working fine in Firefox, but I was messing with it the other day to add a third virtual host and now example2.foo for some reason gets me the content of example1.foo. If I go to example2.foo/includes/main.js, I do get the correct file, so there is something specifically wrong with the example2.foo/index.html. If I try to hit example2.foo in Safari, which I never really use, then it works fine.
From this kind of experimenting, it would seem like Firefox is caching something, but I'm not sure what it's caching or how to flush it. Anyone have any thoughts on this? I have tried to clear private data in Firefox, clearing everything except cookies and saved passwords.
UPDATE: I restarted my computer, cleared the Firefox's cache again, and fiddled with the hosts file a little bit. Doing all of these things resolved the problem and now we're good to go. If someone knows why this happens, I'd be curious to hear an explanation.
It could be almost anything, in that 1) we don't know what experiments you did (did you ever trty the host by IP?) 2) we don't know the edit history on your httpd.conf (and did you remember to restart apache every time? and 3) we don't know how you're routing things to the server (real world DNS, your personal hosts file, or...)?
In such a situation, the general rule is to assume that everything caches stuff, everything in the cache(s) is wrong, and try again with a clean bench after any such change.
-- MarkusQ