HTTPS setup problem with Virtual IP address - apache

We are setting up for the HTTP configuration for our project with the httpd
But our physical IP address and the virtual IP address is not the same
Where the physical IP address is system IP address and virtual IP address is added in DNS configuration.
We need to setup httpd with the virtual IP address. not with the system IP address.
How can I do this without changing the DNS entry?
Please let me know the configurations for the httpd.
thank you.

You only need to bind http on port 80 (and 443 if you are not off-loading the secure layer).
Every request reaching your apache will be served according to the configuration (plain, virtualhost, etc).

Related

Real IP address + port from cloudflare over nginx proxy manager to apache

I'm looking for a way to "pipe" the clients real IP address and port from Cloudflare over NGINX Proxy Manager to the main webserver apache.
The system is implemented in docker. The domain is configurated by cloudflare with proxy. I got a docker container with nginx that pipe the users requests to the apache container.
I want to log the original, real IP addresses AND the ports of users. I don't care where I pick up the data, whether it's from NGINX or Apache or, if necessary, from cloudflare. Preferably with the apache.
In PHP you get with:
$_SERVER['REMOTE_ADDR'] -> the IP address of the NGINX container (sure)
$_SERVER['HTTP_CF_CONNECTING_IP'] -> the real IP address of the user (what I want)
I don't know whether the original port is behind $_SERVER['REMOTE_PORT']. Probably not.
With Cloudflare there is the possibility to define additional fields in which the port could be passed through. How do I get to the field / the port.
Thanks a lot and best greetings
Mtz
A wasy to pipe the users original IP addresses and ports through Cloudflare and NGINX to apache (to log them).

Ubuntu Server with Apache domain management

I'm currently trying to set my Apache configuration on ubuntu server. I have one IP(ex: 34.228.1xx.xx) and one domain(ex: mydomain.com).
I succeed to connect "Apache2 Ubuntu Default page" using IP 34.228.1xx.xx
Then I added 34.228.1xx.xx mydomain.com in hosts file(/etc/hosts) and restarted apache using this command sudo service apache2 restart
But I can't see "Apache2 Ubuntu Default page" using domain mydomain.com, but I still can connect it using IP 34.228.1xx.xx
This is my first web hosting I know my question is messed.
Thanks you in advance.
0.0.0.0 is not a port, it's an IP. And it is a special one which shouldn't go to /etc/hosts. Remove it.
To access Apache on the local machine (on the same on which Apache is running), use "127.0.0.1" or "localhost" as host name in your browser.
On all other machines, use either the machine's IP or its DNS name.
Of course, you have to ensure that the DNS name is pointing to the right IP. This should be a public IP (not something like 192.168.x.x or 10.x.x.x etc.) If you haven't done so already, you must register this name with your DNS hosting provider as a DNS "A" record.
Additional points to consider:
Firewall on Apache machine must be open for incoming traffic on ports tcp/80 and/or tcp/443
If your server is behind NAT, there must be a "forwarding" rule on the NAT machine

Binding IP in apache

Actually I am a beginner to the concept of virtualhost in apache so forgive me if I am being silly here. My question is :-
Is there a way that I can bind apache to listen on public IP/network interface of other server like Listen 54.27.123.255:80
Generally we use :
Listen 80
Listen 127.0.0.1:80
If you have multiples IP addresses on the one machine (e.g. multiple NIC cards) then you can use that syntax to have Apache, or certain vhosts in Apache, to only listen on one. For example you could have one vhost serving a site on one IP address and another vhost serving a different site on a different IP address which also resolves to that server. If you do not supply an IP address but just a port then Apache will listen to all IP addresses.
What you cannot do is use that syntax to steal network traffic for an IP address associated with another server - to do that Apache would need to be running on the server that IP address is associated with.

Direct incoming port 80 traffic to local virtual host

I am running MAMP Pro on a Mac and I have port forwarding set up on my router to forward traffic to my server. For now I just have an IP for my computer, no domain name or DNS setup, although I could do that. What I want to do is forward incoming traffic to a particular virtual host on my server. e.g. MAMP has a localhost by default. I have a number of other virtual hosts, xxxx.local, and I would like to forward to a particular one. Can I do that by editing httpd.config or the hosts file.
Apache "sees" the "host name" of the incoming request and forwards it to the virtual host with the same same. All other requests are captured from "localhost".
It's called "single link multihoming",means one IP address for a lot of virtual hosts.
Greetings,
Peter
I actually just pointed one of my domains to my home server IP and that works since it has a domain name and I have a local virtual host setup. My original question was whether it is possible to do something like that if you just have an IP (i.e. can you send all requests to an IP to a particular single local virtual host rather than to the default localhost), and I guess the simple answer is no. It forwards those to the localhost.

Multisite installation, each website should have different IP

I have 17 sites with a multisite installation and uses the domain access module. This means that I have the same code base and same database for all 17 sites.Is it possible to configure Apache(hosting server) in such a way that all sites have a different IP even if the physical location for all sites is same?
Sure, if your server is set up to accept traffic for each IP, you just need to use IP-based VirtualHosts instead of name-based VirtualHosts.
Namely, you'll need to have Apache Listen directive for each IP address in apache.conf, and each VirtualHost block would have to reference the IP address its listening on.
More info:
Creating Name and IP Based Virtual hosts in debian (it's not really just for Debian)
Name-based hosts on more than one IP address (VirtualHost Examples)