Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 12 hours ago.
Improve this question
I have VDS server without a normal domain. It has only DNS zone vm-4bbd6831.na4u.ru provided by my hosting service NetAngels.
Server has Ubuntu 22.04 with LAMP stack installed.
I should move to this server multiple websites, each website on its subdomain.
For instance:
site1 has address site1.vm-4bbd6831.na4u.ru
site2 has address site2.vm-4bbd6831.na4u.ru
and so on...
I tried configuring vsost like this:
<VirtualHost *:80>
ServerName site1
ServerAlias site1.*
DocumentRoot /var/www/site1
<Directory /var/www/site1/>
Options +ExecCGI -Includes -Indexes
AllowOverride All
</Directory>
I think i tried to change ServerName and ServerAlias with all possible values, but every time I reload apache and try to access http://site1.vm-4bbd6831.na4u.ru/ in web browser, I get only 'Server not found' message.
Give me please a clue, how can i configure vhosts...
I'll be very pleased, if you explain me how to properly use ServerName and ServerAlias
Thanks!!!
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I'm trying to get Apache Virtual Host to work but it wont catch the domains and goes out on the internet instead.
I've enabled the Virtual Host in the Config file:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
My httpd-vhosts.conf file looks like this:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "//nas/Web Design/Sites"
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#fdn.dk
DocumentRoot "//nas/Web Design/Sites/Fdn"
ServerName fdn.dk
ServerAlias www.fdn.dk
ErrorLog "logs/fdn/error.log"
CustomLog "logs/fdn/access.log" common
</VirtualHost>
http://Localhost works fine but when i type fdn.dk or www.fdn.dk the browser tries to find the site on the internet instead of looking at my local folder.
What is wrong...??
I tried to find a solution on the internet but without luck.
Do I need to change something in the host file ???
Kind Regards
Flemming
Yes, you need to add that domain name to /etc/hosts file if you are using an operating system that has it.
Or to C:\WINDOWS\system32\drivers\etc\hosts if you are using Windows.
Example of record:
127.0.0.1 www.fdn.dk
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 10 months ago.
Improve this question
I created a AWS instance to hold my jenkins and archiva services 5 days ago.
I already have my own domain, and created DNS Subdomain jenkins.mydomain.com and archiva.mydomain.com entries to redirect to my AWS instance.
But, I wanna use something like that:
jenkins.mydomain.com instead of jenkins.mydomain.com:8080
archiva.mydomain.com instead of archiva.mydomain.com:8081
Someone can help me?
I already instaled a apache2 service too.
Editing... to make more clear because i don't figure out anything...
I have my own domain: mydomain.com
I created a CNAME entry dev.mydomain.com on DNS server that point to somename.no-ip.info
I created a AWS instance and installed no-ip update client. So I have sure that somename.no-ip.info is pointing to this machine
On this machine I have 2 services: Jenkins on port 9090 and Archiva on port 9091.
I'm able to access these using somename.no-ip.info:9090 and somename.no-ip.info:9091
I'm also able to access it from dev.mydomain.com:9090 and dev.mydomain.com:9091
What I want, if it's possible, is access from jenkins.mydomain.com and archiva.mydomain.com
adding a reverse proxy in apache will fix this problem , something along the lines of wiki.apache.org/httpd/TomcatReverseProxy
It's working now.
I make CNAME entries for jenkins.mydomain.com and archiva.mydomain.com both pointing to somename.no-ip.info.
On my /etc/httpd/conf/httpd.conf i setted:
NameVirtualHost jenkins.mydomain.com:80
<VirtualHost jenkins.mydomain.com:80>
ServerAdmin admin#mydomain.com.br
ServerName jenkins.mydomain.com
ProxyPreserveHost On
ProxyPass / http://localhost:9090/
ProxyPassReverse / http://localhost:9090/
</VirtualHost>
NameVirtualHost archiva.mydomain.comr:80
<VirtualHost archiva.mydomain.com:80>
ServerAdmin admin#mydomain.com
ServerName archiva.mydomain.com
ProxyPreserveHost On
ProxyPass / http://localhost:9091/
ProxyPassReverse / http://localhost:9091/
</VirtualHost>
But now I'm getting this warning:
[warn] NameVirtualHost archiva.mydomain.com:80 has no VirtualHosts
Someone knows how to fix it?
This reply is late and I'm sure you have figured it out by now. I see your NameVirtualHost with an 'r' tagged at the end of your .com, which I am sure is a typo and thus creating your problem.
HTH
you also need to create a virtual host to let appache point to the correct folder when request is made on port 9091
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
Using a virtual host, and a server alias, I'm getting a strange redirect that I do not understand where it is coming from.
Using stock apache2 on Ubuntu 12.04. Only the following changes to files in /etc/apache2/...
I have added a new virtual host as follows in the file sites-available/foo-com and enabled it with a2ensite
<VirtualHost *:80>
ServerName www.foo.om
ServerAlias foo.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www/www.foo.com
<Directory /var/www/www.foo.com/>
Options FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
I also have a second virtual host for www.bar.com, which is exactly the same as above, but with foo replaced by bar
I have changed the default virtual host to a different document root
DocumentRoot /var/www/default
<Directory /var/www/default/>
.....
When I navigate to http://foo.com, I get a 301 redirect to http://www.foo.com/www.foo.com , which obviously returns a 404. Even more strangely, navigating to http://bar.com returns the relevant site correctly without a redirect.
I've been tearing my hair out trying to understand this strange behaviour. I've verified that there are no redirect's anywhere else in the apache confs. There is no reference to foo.com anywhere except the virtual host above. There is no .htaccess files in the document root.. I created the directory from scratch.
What else could be causing this?
From http://httpd.apache.org/docs/2.2/en/howto/htaccess.html
Further note that httpd must look for .htaccess files in all
higher-level directories, in order to have a full complement of
directives that it must apply. (See section on how directives are
applied.) Thus, if a file is requested out of a directory
/www/htdocs/example, httpd must look for the following files:
/.htaccess
/www/.htaccess
/www/htdocs/.htaccess
/www/htdocs/example/.htaccess
Looking at your rewrite log, it would seem you have a .htaccess file stuck in /var/www . Removing it or, preferably, disabling .htaccess should solve your problem.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
At the moment my virtualhosts look somewhat like this:
<VirtualHost 11.111.1.111:80>
ServerName mydomain.com
DocumentRoot /var/html/mydomain.com/public
CustomLog /var/log/http/mydomain.com-access-log combined
</VirtualHost>
This logs all requests for this particular website to its own log file, which I am happy with.
What I would like to do is have all virtualhosts (including this one) also log all of their requests to a shared logfile, in addition to their own logfile. I'd also like to limit the shared logfile to particular filetypes too (for example just HTML pages or just images).
I'm not sure if this is even possible?
Try the following vhost:
<VirtualHost 11.111.1.111:80>
ServerName mydomain.com
DocumentRoot /var/html/mydomain.com/public
#vhost logfile
CustomLog /var/log/http/mydomain.com-access-log combined
#shared logfile of images
setenvIf Request_URI ".(jpg|jpeg|png|gif|ico)$" logimg
CustomLog /var/log/http/images-access.log combined env=logimg
</VirtualHost>
Br,
E-raser
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a local Apache server running on the network and I've got a number of tester machines. I want to be able to connect to a specific website on the localhost, at the moment it just connects to the first website.
For example: 192.168.1.125/mywebsite.
I've looked around I cannot find the method of conneciton, I know it's something really simple but everywhere I look answers a different problem. (Maybe this is too simple).
So basically I'm asking, how do I access the other servername though the browser. (setup is like so:)
<VirtualHost *:80>
DocumentRoot c:/vhosts/website1
ServerName website1
</VirtualHost>
<VirtualHost *:80>
DocumentRoot c:/vhosts/website2
ServerName website2
</VirtualHost>
I've tried
192.168.1.125~mywebsite
192.168.1.125:80/mywebsite.
192.168.1.125-mywebsite.
Can anyone help me here? Also what's the English for this? Namespace? Name-server or something?
*I get the error "Object not found" with these.
Name-based serving of apache is based on the actual hostname in the request. To make this work, you have to be able to reference that IP by any names you need. You have to be able to do http://hostname/ and not http://IP for name-based virtual hosts to work.
You can do this either with a hosts file (for a single host) or over DNS. Neither is a programming problem though.
Use virtual hosts. i.e. have something like this in the httpd.conf file:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName <make up a hostname here e.g. example.com>
DocumentRoot "<path to the web site files>"
</VirtualHost>
<Directory "<path to the web site files>">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Then add the following to the to the hosts file in C:\Windows\System32\drivers\etc
127.0.0.1 <made up hostname as above>
Then you can access the web site as http://<hostname as above>
Guess it will be the same for Linux except the file would be /etc/hosts. You can repeat this as often as necessary.
EDIT Use the following it /etc/hosts on both the machine running the server and the machine running the browser
192.168.1.125 website2.example.com
192.168.1.125 website1.example.com
Then edit the two copies of the virtual hosts stuff above using the website1.example.com and website2.example.com
Shot in the dark
Map your testing machines to your server
~/test_machines/web_1
~/test_machines/web_2
~/test_machines/web_3
Then add the site entries to your vhost.conf. Use VirtualDocumentRoot from mod_vhost_alias. You can see the examples here: http://httpd.apache.org/docs/2.2/mod/mod_vhost_alias.html