How to configure Apache to use ipaddress/~username - apache

I need to test a website before switching its DNS and I'd like to learn how to configure the webserver in order to access sites with http://ipaddress/~username, like cPanel does.
I'm using Ubuntu Server 14.04.2 LTS.
Thanks

mod_userdir provides the ~username support. On ubuntu, use a2enable userdir to load and configure mod_userdir. By default, your server should respond to requests to its own IP address so no action is required there.

Related

Allow IP through htaccess using Cloudflare Proxy

I'm using
Allow from 123.234.12.23
to whitelist IP addresses without needing to enter in the htpasswd credentials.
I've just switched to use Cloudflare proxy (to protect bypassing CF firewall) but now all requests to my server (from Apache logs) are coming in as Cloudflare IP's.
How can I access the requester's actual IP so that I don't have to keep entering in the credentials if I'm on a whitelisted IP?
To do this you need to install mod_cloudflare for Apache.
https://support.cloudflare.com/hc/en-us/articles/200170916-Restoring-original-visitor-IPs-Option-1-Installing-mod-cloudflare
Since my machine was running on Ubuntu, I ended up following the guide from this site which worked for me to install it on Ubuntu.

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.

How to enable SSL in docker with nginx hosted in Ubuntu

I have a web application that's running inside a docker container.
It's written in Play Framework. My host is an Ubuntu 16.04 server with apache. Docker application use the nginx server. The port 443 is directed to that container. SSL in my Apache server is turned off. Now when i try visiting my domain with https the browser give the warning which is annoying.
So i got some free certificates from sslforfree.com and used it with the docker application but still the warnings come up. Do i need to use those certificates in the apache server too?
Yes.
Your browser speaks with Apache server trying to establish an SSL communication at first, then Apache will try to forward the request to your docker container.
So, indeed, it's only mandatory to secure your Apache instead of the container to have the browser not complaining.

Installing and Configuring Apache 2.4 on windows

I have been tasked with Installing and Configuring Apache 2.4 on a windows server for the following purpose:
Configure SSL through apache
Apache Tomcat also installed on server to handle web request to a specific web application - MySQL db also on the same server.
How does one go about installing and configuring SSL through apache 2.4 on Windows Server 2012?
I have read so many documents and so many questions on forums etc and is now more confused than before.
http://httpd.apache.org/docs/2.4/
https://www.sslshopper.com/article-installing-an-ssl-certificate-in-windows-server-2008-iis-7.0.html
So far i have download and installed apache as a service and created the Certificate service request from OPENSSL (downloaded and installed also).
All I need to do now is :
How does one import these certificates in apache ?
How do you test if the import was successful and if ssl is working ?
How to redirect Apache to Apache tomcat to serve the webpage
Can someone please outline the steps require and if possible how to perform these steps for apache in Windows.
Thanks.
Regards,
Robert Ramoutar.
How does one import these certificates in[to] Apache [httpd]?
http://httpd.apache.org/docs/2.4/ssl/ssl_faq.html#realcert
How do you test if the import was successful and if SSL is working?
Connect to the server using a web browser with HTTPS. If it works, and the certificate looks the way you wanted it to look and you don't get an errors/warnings, then you are good.
How to redirect Apache [httpd] to Apache Tomcat to serve the web page
You need to use a module for reverse-proxying like mod_proxy. Read the documentation for mod_proxy_http to see how to set one up.

Configure virtual host on Apache

I have a VPS with a single IP address and with Virtualmin/Webmin installed. I have created a virtual host *example.com *that will answer to www.example.com (the domain already points to the IP address of the VPS). However, when I access www.example.com I am not seeing the website I have uploaded for example.com but rather the default server:
It works!
This is the default web page for this server.
The web server software is running but no content has been added, yet.
What should I do? Do I have to configure DNS or something?
Yes, you will need to configure DNS for your www.* site if it has not been done already. This www.* alias may have been created automatically when you set up the domain in DNS, but perhaps you will need to specify it explicitly.
Seeing the message "It works!" is a common issue. Apache has a default virtual host which you may want to disable. Exactly how to do that depends on the platform of your web server (it's a good idea to mention the platform and version when asking questions).
For example, if you have shell access to a Debian or Ubuntu machine, you can use the command:
sudo a2dissite default
In virtualmin there may also be an option for this, see for example http://www.virtualmin.com/node/15854
Once you have DNS set up and the www.* domain responding correctly to pings with IP of your server, you will also need to make sure that the virtual host definition for your site includes the www.* alias.