I have ubuntu virtual machine that connects to it remotely with public IP. I installed apache2 server on it. However I can't reach the server from the web browser. Can anyone tell what the security rule should I add to access the web page?
I tried
$sudo ufw allow in "Apache Full"
and
#sudo ufw allow 80/tcp
Related
Recently I installed SSL cetificates through Certbot on apache2 server, and my website can be accessed through HTTPS. I have also enabled redirect to HTTPS. But I can no longer connect to the server via SSH. What can I do now?
You should allow the 22/tcp while setting up the ssl certificates.
To do this, you have to check if ufw statusis active.
If it is inactive, then let you allow active.
sudo ufw enable
sudo ufw default deny
And then execute sudo ufw status command and you have to see following.
Status: active
To Action From
-- ------ ----
Apache Full ALLOW Anywhere
22/tcp ALLOW Anywhere
Apache Full (v6) ALLOW Anywhere (v6)
22/tcp (v6) ALLOW Anywhere (v6)
If you can't see the 22/tcp is allowed, then allow the ssh.
sudo ufw allow ssh
Then you will be able to connect to the server using SSH after installing ssl certificate.
While setting up, if the UFW is set to allow port 80(HTTP) and 443(HTTPS), but not 22(SSH), then HTTP and HTTPS would work fine but not SSH. This means that you can get locked out of your server if you don't allow connecting to it via port 22 (SSH).
I'm running Ubuntu on vmware under windows 10, I set up and configured my apache to these configurations:
/etc/apache2/apache2.conf
<Directory /> ... stuff ... Require all granted </Directory>
VirtualHost1
<Directory ...>
....
AllowOverride All
Require all granted
</>
When I call the website from within the ubuntu on my vm it's reached fine, but when I call this site from my windows vm host machine my conn. gets refused.
This is my ubuntu hosts file:
127.0.0.1 test.com www.test.com
this is my windows hosts file
127.0.0.1 test.com www.test.com
**** All the listings here are approximate, so don't quote mistakes in code, apache restarts just fine
For all intent and purposes, a virtual machine is not the same as the host machine. Their network is totally separate.
If your virtual network is bridged, you need to access your ubuntu web server from it's public interface, usually eth0. This means, you will need to edit hosts file in windows to point www.test.com to the public ip address of ubuntu.
If your virtual network is NATted, you need to configure port-forwarding. I recommend using the same port numbers, if possible, for ease of use. You can keep the windows host table the same way you already have.
In both cases, the apache web server should listen on the public interface.
This depends on how you have configured you virtual host networking settings.
The 127.0.0.1 refers to you windows host on the windows machine and 127.0.0.1 refers to the ubuntu host on the virtual machine. The concept localhost (127.0.0.1) is always local host and should not leave the actual network interface (virtual or not). You need to contact you virtual host on virtually "external" ip-number from windows.
You can get the ubuntu ip-number by running "ifconfig" in a shell.
Best regards
Jørgen
Just installed WAMP on a Windows 7 machine.
When I go to localhost / from the localhost, everything works. But when I try to go to the machine from another computer on the local network, I get the following error message:
Forbidden
You don't have permission to access / on this server.
Apache/2.4.9 (Win64) PHP/5.5.12 Server at 192.168.1.13 Port 80
How do I solve this?
See the below question. You have to allow access through port 80 to your Apache server in httpd.conf by making sure you have Listen *:80
How to access site running apache server over lan without internet connection
An additional resource with items to do when you install a fresh copy of WAMP
http://forum.wampserver.com/read.php?2,119754,119754
Click on wamp icon > Apache > Apache modules > rewrite module(enable this module)
I was using virtual box and have had httpd installed on it, the network was configured as 'nat' and I forward port 8080 of Host Machine to port 80 of Virtual Machine.
Then I tried to access the Website hosted on the virtual machine via curl localhost:8080 -vv, but I got Empty reply from server, instead if I use curl 127.0.0.1:8080 -vv then everything is ok, why would it be like this ?
I was trying to configure apache server to be accessible from other WAN computers
Tried this and other procedures that I have found in different forums but it still isn't accessible:
*Set my rooter port forwording to 8080
*configured the httpd.conf to listen to port 80 and granted all access to DocumentRoot directory
I assume that Wamp Server is running fine on your localhost.
Suppose your IP Address is 192.168.5.10:8080 to access wamp Server and the same you want to access from other PC on WAN. Then Click on "Put Online" as mentioned in the Screenshot.
It will restart the wamp Server. Just wait until the Wamp Color Become green and you will be able to access your localhost wampserver website on your network.
I hope this will work for you