Can't Access to my Amazon Instance with public Ip - apache

I have a new amazon instance EC2, and I want to build a Web Server so I did :
Install apache2
Install libapache2-mod-php5
a2enmod rewrite
Add a Http rule in the default group to allow all IP
add Directory AllowOverride All in /etc/apache2/sites-availables/ default-conf
But when I want to check if apache is running by typing the public ip of the instance in my browser, I dont have the basic index.html "it's works". I got nothing.
What does i missed ?
Thanks you.

If apache is running fine, then it might be the firewall.
In the AWS console, make sure you have unblocked port 80 in the "Security Groups" under "Network & Security".

I found the solution.
It was a problem with the firewall.
The security group that I changed was not the one that was linked with my Instance
My bad.

do you know if the apache is running? you can check with:
ps aux |grep -i 'http\|apache'
if it has not started, you can try:
/etc/init.d/httpd start

Related

Apache server does not show up on EC2 IP

I am trying to install apache2 on my EC2 instance.
I did the following steps:
Launched an Ubuntu 16.4 instance with security group details
http - 80 - anywhere
https - 443 - anywhere
Once I login to my instance I did
sudo apt update
sudo apt install apache2
when I type
service apache2 status
it says that Apache is running
I assumed that after this if I go to my public IP address [xxx.xx.xx.xx] I would see the default apache server page.
But I see This site can't be reached.
The process seems pretty straightforward, what am I doing wrong?
I had this stupid case, it made me reinstall dozens of times.
Maybe my Security groups don't allow https://
Replace https:// with http:// if available.
It will work perfectly.

EC2 public instance not accessible

I am facing this issue as I am new to AWS EC2. I have setup an instance and ssh working perfect. I installed httpd, mysql, php and httpd and mysql services running fine.
I can't access EC2 public DNS in a browser. I already added a rule for HTTP with port 80 but still not working. What can be the other reasons?
For this trouble shoot like below :
Step 1) ssh to instance and stop the iptables if it is running.
Step2) if above step not resolves the issue, please post the log out put of browser. is it 404 error or DNS not found or 403 something like that. Then I can assist you.

Starting web server apache2 failed

I have a Virtual Server. Till yesterday everything works fine on it.
Today my Hostcompany restarted my server to config something on I/O.
When I trying to get to my address I get
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.
I tried to sudo service apache2 start and get these Error Message:
* Starting web server apache2
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
*
* The apache2 instance did not start within 20 seconds. Please read the log files to discover problems
Does someone know how I can fix this problem?
Stop Nginx service nginx stop
Restart Apache service apache2 restart
You have another webserver that's running on the host (probably as part of the startup during the restart) You need to shut that off first.
You can run netstat -tulpn | grep :80 and that'll tell you what that process is
The problem is this, Nginx (another web server engine) it's using your port 80 so apache it's unable to start, a fast fix it turn of nginx and then restart apache.
You can do it with service nginx stop and service apache2 restart if you are using Ubuntu or Debian based release, if you are using an RHEL distro then use service nginx stop and service httpd restart
Here is my solution
first: sudo update-rc.d -f nginx remove
than: sudo rm /etc/init.d/nginx
after restarting VM almost everything works fine. Some strange thing is almost there.
When I goto www.myfoobarwebpage.com now apache is working and it's all ok!
When I goto myfoobarwebpage.com (without www.) I get "Welcome to nginx! ..."
Try this. My Apache config has 2 extra lines by mistake.
"Include conf/extra/httpd-8080.conf"
"Include conf/extra/httpd-8080.conf"
Therefore, it was saying address already in use because it already loaded the Virtual host once and was trying again.
Solution was to delete this extra line and have only one include.

httpd running internally but not externally

I have a new server running CentOS, and it has httpd running on 192.168.1.100:80.
I can connect to my server through ssh on 192.168.1.100, but when I go to 192.168.1.100 in my browser, it says "Oops! Google Chrome could not connect to 192.168.1.100".
I also tried wget to see if that works, and here is where it gets interesting.
when I run:
wget 192.168.1.100
On my server it gets the index.html file as it should.
but when I run it on my laptop is says "Connecting to 192.168.1.100:80... failed: No route to host."
Does anyone know how to fix this?
Seems like your Apache configuration binds httpd to 192.168.1.100:80
Find line Listen 192.168.1.100:80 in Apache main configuration - something like /etc/httpd/httpd.conf or /etc/apache2/httpd.conf and change this line to Listen 0.0.0.0:80.
Restart Apache and it will probably work.

Apache is running but not working

I am running a huge php-application on an ubuntu server, using apache2, php5, mysql.
Sometimes (approx. once a month) the page ist not reachable from the internet ("it's down").
The weird thing is, that service apache2 status says that apache is running.
The solution is always to restart apache using service apache2 restart and everything works fine again.
The server load is at a minimum and can't be part of the problem (I guess).
I know, this description is not as detailed as it should be, but I do not have more information.
Any suggestions about what could cause this problem are appreciated!
Disable Firewall or Antivirus and try again.
Change /etc/apache2/apache2.conf => change all AllowOverride all,
and make sure that /etc/apache2/sites-available/000.default.conf => verify the path of the Directory that you access.
assign the necessary permissions of the webroot directory for the domain.
chmod -R 755 /var/www/html/