Apache2 virtualhost configuration trouble - apache

This is my situation:
I have Redmine and Gitlab in my server which does not have a domain associated, because I will use the server IP address.
I want to configure two virtualhosts in apache2 with SSL in order to serve the above web applications, so I can access them like this:
https://x.y.z/redmine
which is located in /var/www/
https://x.y.z/gitlab
located in /home/git/github/public
I have configured apache by enabling two files in site-enabled: github.vhost and gitlab.vhost. The problem is that I cannot set gitlab to be accessible with
https://x.y.z/github
but only in
https://x.y.z
probably beacuse I do not use a domain but only the IP address of the server, and I don't know exactly how to manage it.
I would need some suggestion on how to correctly set the two vhost files.
Any suggestion?

Related

Multiple Apache Virtual Host Files with one Document root?

I've set up a single VPS running Apache, with an application installed in /var/www/html/. I have a domain [example-1.com] to the server IP.
I'd also like the same application to be served on [example-2.com]. Something similar to creating an 'Alias' domain.
Is it possible to have two Virtual Host Files configured at one document root?
Yes, no problem. The document roots can point wherever you want them to. If the configuration of the second virtualhost is the same, you could also use the ServerAlias directive.

How do I configure apache for subdomains on pi in my own local network?

I want to access multiple websites at home on my pi apache server, like this:
projectA.localhost
projectB.localhost
or :
projectA.192.168.0.24 - IP of my pi.
I have tried to add vhost, but nothing has changed.
I can redirect my /var/www/ to other places but i want have a structur like:
/var/www/websites/projectA
/var/www/websites/projectB
I do this by modifying the hosts file on machines on my LAN that will access the server. That way, there is no special magic that has to occur in Apache (meaning that the web site can be moved to a public host without re-configuration.)
For example, configure Apache as typical with virtual hosts projecta.com and projectb.com (or projecta.localhost and projectb.localhost, if you prefer). There is no special Apache configuration on the server.
On the systems that will access projecta and projectb, configure the hosts file to point to the server's IP address:
projecta.com 192.168.0.24
projectb.com 192.168.0.24
-or-
projecta.localhost 192.168.0.24
projectb.localhost 192.168.0.24
Apache will properly route requests to the appropriate site.

Rewrite with multiple symfony projects under same directory

I'm trying to make some personal projects in my development server, like some sort of intranet.
If I divide each project in a different virtualhost, I set in each computer the host file to each server name and I don't have problems with the rewrite rule and the app.php. But the problem is that I can't modify the host file in an android device so I can't access those webs.
What I have in mind is something like this:
I have three symfony projects under my home folder
/home/user/projects/project1
/home/user/projects/project2
/home/user/projects/project3
Then, under the default folder of apache I make soft links to the web folder to every project:
ln -s /home/user/projects/project1/web /var/www/html/project1
ln -s /home/user/projects/project2/web /var/www/html/project2
ln -s /home/user/projects/project3/web /var/www/html/project3
So I can access them this way:
http://server-ip/project1
http://server-ip/project2
http://server-ip/project3
The problem is that I use those url I need to add the default app.php. I've been trying to modify the .htaccess file of each project, but I don't what to modify. I'm using the default virtualhost configuration and the default .htaccess file of each project.
I think that I need to modify the RewriteCond line, but I don't know what to do.
Thanks
I've got a local development environment (it's actually running on a linux server, under my desk, but the same setup would apply to any other configuration of server).
The webserver has a local IP address, reachable from elsewhere on the local network, including from my phone over WiFi.
All the development sites have their own Vhost configured on the server, with a common DNS prefix - something like *.devserver.domain.com.
The DNS is configured so that devserver.domain.com and the wildcard *.devserver.domain.com return 192.168.1.75 (or whatever the internal, static IP address is). This is a public domain name that has an A record to a local-range IP address, but it's entirely valid.
If you don't have a domain name that you can add wildcard DNSs to, you can use a service such as http://nip.io/ - and so the vhost Servername would be something like:
project1.192.168.1.75.nip.io
project2.192.168.1.75.nip.io
... etc
You may end up regularly editing the apache vhost if you internal IP changes at all, and maybe finding alternate wildcard DNS servers (my go-to was xip.io, but that isn't diffcult to do).
You may also be able to use an internal wildcard for an Apache ServerName/serverAlias: ServerAlias mysite.*.xip.io.

Home apache web server - final hurdle

Ok, so bit of noob question - having one of those days.
I have set up a home apache web server on Ubuntu. I have configured vhosts as I want to host multiple websites. These work fine in the local browser, e.g.
http://site1
http://site2
both display their various contents.
For the server side of things, I've configured port forwarding on my router to send all port 80 requests to the server IP.
When I go to an external browser and type in my servers external IP address I get the standard apache "It works!" message. When I type in ipaddress/site1 I get 404. The site1 is not in the standard apache default directory, I have it in home/username/Sites/site1 folder and httpd.conf file knows this.
How is it I can access these site1 and site2 sites externally?
Cheers
Just as you would do in your local browser. So typing in http://site1 would lead you to the first site. This is based on an assumption though, which is that you put the http://site1 address in your /etc/hosts file. When your computer looks up an URL, it first checks the hosts file (and your case will find the correct IP address there) and next will ask a global mechanism for the address.
The reason why it doesnt find anything at "ipaddress/site1" is because of the vhosts configuration. This teel Apache serve the content of a folder somewhere on your server as a separate hostname, e.g. http://site1. If you're requesting "ipadress/site1", you're actually telling Apache to look in the folder "site1" in its first root it encounters in your Vhost configuration.

tomcat DNS forwarding with multiple applications

I recently installed business objects software on tomcat 6. I have 2 domains - domain1 and domain2. This software allows access to two of its applications via these URLS:
xxxxxhttp://myservername.domain1:8080/BO/APP1 and xxxxhttp://myservername.domain1:8080/BO/APP2
Instead of these urls, I would like the end users to access these apps via something like http://bobj.domain2.com:8080/BO/APP1 and http://bobj.domain2.com:8080/BO/APP2.
I cannot figure out how to accomplish that. I have looked into the option of http redirect (not good because the destination address shows up in the address bar), domain forwarding (not sure if it would work with multiple applications and forwarding from one domain to another) and also using apache tomcat with mod_jk by using virtual hosts (not sure if it is possible when forwarding from one domain to a sub domain in another domain) ??
Experts, please advise as to what would be my best option and how to accomplish.
thanks a bunch
There must be a DNS entry for bobj.domain2.com to point to your IP address. Then adding a ServerAlias directive to Apache should do the trick. You can also use wildcards, e.g. DNS entry for *.domain2.com, and ServerAlias *.domain2.com.