Virtual Host using Apache - apache

We have development team of 10 people working on Linux platform our application is hosted on Apache server
Now what i want if every developer is having own codebase in his directory
he can have his own httpd conf file which uses his code base and his port on that server
and whenever he changes the code base he needs run only his apache process
and there is no need to start , restart the apache server as other people should not get disturbed
so can we do this listening same server on different ports with different DocumentRoot and no need to start or restart the whole apache server only individual process of apache need to be started if any changes are done in the local conf file of that user

You need not get into the complexity of managing virtual hosts.
You can create alias for each developer which will point to his directory.
http://httpd.apache.org/docs/1.3/mod/mod_alias.html#alias
Eg :
servername.com/dev1/
in httpd conf point dev1 to developer's working folder.
Developer can update code see the result at the above url without restarting server.

Related

Handle multiple domains without restarting HTTP server

Let's assume I have multiple domains pointing to one server.
I know that I can have multiple virtual hosts in Apache for example, but every time I want to add a new website I have to change the configuration and restart the server.
I am looking for hosting multiple domain names without having to create a config file each time.
Why ? because after creating a config file, I have then to restart the HTTP server which means that each domain I add will block all the other domains for a period of time.
Basically I want a config or program that points dynamically each domain to a sub-folder of my main source code without having to create a config file or restarting the HTTP server.
Please let me know if this is doable with the current HTTP servers or if not point me to some resources that will help me do this programatically.
With most standard web servers you simply cannot do this without a restart or at least reload of the service (so it picks up the new configs).
Of course you could build your own solution, based on your requirements.
You can reload the server without restart it, a reload keep the active connections up, so you can load the changes in your configuration without restarting the server.
Command for nginx: nginx -s reload
I suggest to use nginx -t && nginx -s reload in order to check the configuration before reloading
Command for Apache: apachectl -k graceful, systemctl reload httpd.service, service apache2 reload, service httpd reload (it depends on your environment)

Setting firewall rules to enabling running Apache2HttpServer and ApacheTomcat 9 on the same machine with two different hostname/ip:port

I have a Virtual Machine Linux Debian 10, with two Host-Only Network interfaces actived respectvely 192.168.56.10 and 192.168.56.15 with static ip address.
Apache Tomcat 9 is installed and Apache2 Http Server is installed too.
My purpose is that Apache Tomcat 9 must run on 192.168.56.15:8080,
while Apache2 Http Server must run on 192.168.56.10:80.
The /etc/hosts file in my Linux is:
#
192.168.56.10 www.example.com
192.168.56.15 openam.example.com
#
The C:\Windows\System32\drivers\etc\hosts is the same.
In short I'm trying to setup a small development enviroment for Identity and Access Managment using the Forgerock's AM solution. That software has to be deployed as a .war file (openam.war) in Tomcat /webapps and it will be mapped as openam.example.com, and I want this service run on
192.168.56.15:8080/openam;
So my problem is that I want two different services responding two different interfaces but running on the same Virtual machine.
I want that only if i type 192.168.56.15:8080 or openam.example.com:8080 I recive a respond from Tomcat, but if I type 192.168.56.15:80 or openam.example.com:80 Apache Http Server doesn't have to respond. Apache Http Server have to respond only on 192.168.56.10:80 or www.example.com.
In this way I can have like two different machines one with the web server and one with the application server, responding on two different IP addresses and hostname, but running on the same machine.
Thanks for help!
You could have 2 IPs but what's the point in doing so?
I find it rather pointless to have 2 separate IPs for 2 different services on the same machine (e.g tomcat on 1 / HTTP server on the other) for a development environment inside a VM. Port handling will be handled by the operating system itself and route the request to the open port.
Keep in mind that browsers will try to connect http:// calls on port 80 by default - so unless you type 8080 into the URL the browser it is just going to use port 80.
If you do not want calls to openam.example.com to come in on port 80, the simplest way round it is to use a htaccess rule that implements a rewrite for any request that contains openam.example.com (or just anything in a subdomain portion) on port 80 to be rewritten to the appropriate URL.

Remote access of network computer

I am not sure how or if this can be done. I have a home network and would like to see a computer,not the server, via a remote location. I have Apache on my server. Example: the network computers I would like to see ip 152.254.1.33. Is there a way to add this ip to Apache root directory? I have tried to add a shortcut with in the root directory and it only works on the home network, will not via remote connection.
I need some clarification here on what you are trying to acomplish, are you trying to access the Apache website outside of the local network?
If that is the case, Apache is automatically set to listen on all network interfaces, you can check this in your virtual host configuration in the sites-enabled directory of your apache installation.
You should see something like in the 000-default.conf
You can test if apache is serving pages up correctly using the command
curl 127.0.0.1
You should see the HTML of the page being served.
If this is the case, then it's likely the firewall on your machine/router or your ISP is blocking the required ports. You can allow Apache through the firewall on Ubuntu using sudo ufw allow Apache Full
If you give me some more info in comments we can probably work this out.

WAMP localhost and phpmyadmin setup

I have inherited a WAMP setup, but needed my http://localhost to point to a different directory "C:/Users/[user.name]/htdocs" due to many dependencies.
I made the following changes in httpd.conf
DocumentRoot "C:/Users/[user.name]/htdocs"
<Directory "C:/Users/[user.name]/htdocs">
where the original path was "c:/wamp/www/"
Now the WAMP default path for phpMyAdmin http://localhost/phpMyAdmin is not working anymore.
Is it possible to fix that via either C:\wamp\alias\phpmyadmin.conf or httpd-vhosts.conf somehow?
Can I suggest a better solution to your requirement to have a site running that does not live in the WAMPServer default location i.e. \wamp\www or \wamp\www\somefolder
If you revert all your httpd.conf changes to the out of the box state and then create a Virtual Host to run the site you have located in your \user.... folder.
Virtual Hosts are a standard Apache feature that allows you to run may sites from a single instance of Apache, a bit like a shared hosting package setup.
You would then have the benefits of the WAMPServer homepage running on localhost and all the other alias's tools as well.
You can then run your site using a nice url for example sitename.dev and the virtual host definition also allows you to setup any site specific requirements without effecting any other site you may want to run.
There is a HowTo Setup Virtual Hosts here on SO

Apache does not start - httpd.conf in windows

I am trying to set up Apache http 2.2, with mod_jk module.
The intention is to set up a load balancer right on my PC, for test purposes.
So I made some changes to httpd.conf to set some parameters, then I run it and I get the popup:
"Windows couldn't start Apache 2.2 on local PC. For more information check system events log. If it's not a windows service contact service provider and reference the code:1"
I check on the log and I get:
httpd.exe: Could not reliably determine the server's fully qualified domain name, using 192.168.0.35 for ServerName
So I uncomment on httpd.conf line: ServerName myPcName:80 and run it again.
I get the same popup, but this time I don't get anything on the events log.
Any idea on how to let it work?
(Nothing is bound on 80 port.)
Thank you
Please check if port 80 is being used by other application or not. Most of the time in my case "Skype" was using port 80. So I had to stop it and then I used to start Apache service.
To troubleshoot further what you can do is, goto apache's bin directory and run httpd.exe -t option. This will show you exactly what is causing problem.
The configuration file in the apache /conf folder, has a piece of code that starts from C:. It is copyrighted and therefore you cannot change the code.
All you have to do is make a second copy of the whole apache folder and put it directly in your C: directory. Your apache file is in System 32 causing you to use cprompt right. Having 2 identical apache folders one in C: and one in System 32 bypasses the problem.