Apache Web Server Aws



The web server runs on an Amazon EC2 instance using Amazon Linux, and the MySQL database is an MySQL DB instance. Both the Amazon EC2 instance and the DB instance run in a virtual private cloud (VPC) based on the Amazon VPC service. To set up a LAMP web server on Amazon Linux AMI, see Tutorial: Install a LAMP web server on the Amazon Linux AMI. Now that your instance is current, you can install the Apache web server, MariaDB, and PHP software packages. Use the yum install command to install multiple software packages and all related dependencies at the same time. Compare Apache Web Server vs AWS Auto Scaling. 85 verified user reviews and ratings of features, pros, cons, pricing, support and more. We will now install Apache, Mysql and PHP packages. Sudo yum install -y httpd24 php56 mysql55-server php56-mysqlnd. Start the Apache web server. Sudo service httpd start. Make sure Apache starts automatically at system boot. Sudo chkconfig httpd on. Now you can test if everything is working by typing your IP in a web browser. Amazon Linux Test Page. How to Setup an Apache Web Server with AWS EC2 Instance 2020Git For Windows:an Apache Web Server with PHP:https:/.

Unable to access webserver running on my amazon ec2 instance
Posted on: Jun 28, 2011 11:56 AM
I am running webserver on my amazon ec2 instance but I am not able to access my webserver from outside.

I opened port HTTP(80) 0.0.0.0/0 (Security group) for my amazon ec2 instance.
I checked my apache is running there using curl command
http://localhost/index.html

Replies: 13 | Pages: 1 - Last Post: Jun 19, 2018 4:57 PM by: sgund
Re: Unable to access webserver running on my amazon ec2 instance
Posted on: Jun 28, 2011 12:04 PM
Re: Unable to access webserver running on my amazon ec2 instance
Posted on: Jun 28, 2011 12:18 PM
Re: Unable to access webserver running on my amazon ec2 instance
Posted on: Jun 28, 2011 1:15 PM
Hello pawansd,
I can communicate with your instance via ssh but am unable to communicate on port 80. Since you can connect locally via localhost, I would suspect your apache configuration. Please make sure apache is configured to listen for more than just localhost (httpd.conf or ports.conf).
Regards,
JBrown
Re: Unable to access webserver running on my amazon ec2 instance
Posted on: Jun 28, 2011 1:38 PM
I have verified my apache configuration and it is not just listening for localhost. I have same issue with mysql running on another amazon ec2 instance.
I opened port 3306 but I am unable to connect to mysql database using mysql work bench.
Currently I am connecting to mysql instance using TCP/Ip over SSH connection.
Looks like there is some fire wall block all incoming request in-spite ports are open in my security group
Re: Unable to access webserver running on my amazon ec2 instance
Posted on: Jun 28, 2011 1:41 PM
pawansd,
I'm guessing iptables is not set to allow traffic, please post the following output:
#netstat -ant
#iptables -L

You could try turning off iptables with:
service iptables stop

Re: Unable to access webserver running on my amazon ec2 instance
Posted on: Jun 28, 2011 1:48 PM
I have the exact same problem.
Installed apache. started it. opened the port 80. connection from browser times out.
Re: Unable to access webserver running on my amazon ec2 instance
Posted on: Jun 28, 2011 1:58 PM
Luke,
My instance is i-bb6a17d5
(I am not an expert in *ix environment.)
I ran the command that you provided to switch off the iptables
iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:28017 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:27017 127.0.0.1:59981 ESTABLISHED
tcp 0 0 127.0.0.1:59981 127.0.0.1:27017 ESTABLISHED
tcp 0 0 10.248.47.90:22 216.99.1.32:43594 ESTABLISHED
tcp 0 0 :::80 :::* LISTEN
tcp 0 0 :::22 :::* LISTEN

wget http://ec2-50-19-136-117.compute-1.amazonaws.com/ works on ports 80 and 3000
Edited by: deepatr on Jun 28, 2011 2:01 PM
Re: Unable to access webserver running on my amazon ec2 instance
Posted on: Jun 28, 2011 2:06 PM
After turning of iptables I am able to access my webserver.
Re: Unable to access webserver running on my amazon ec2 instance
Posted on: Jun 29, 2011 10:12 AM
My issue was security group. The instance was in quick start group but I had opened the port to default.
Re: Unable to access webserver running on my amazon ec2 instance
Posted on: Mar 17, 2013 1:34 AM
I have exactly the same problem on a microinstance
I can access the site doing
w3m localhost
but not from outside,
I already open port 80 from security group options.
Te site was working well before, but the just stop working.
Thanks if some one can point me in the correct direction.
My Instance Id is
i-5f20f92e
Re: Unable to access webserver running on my amazon ec2 instance
Posted on: Mar 22, 2013 12:57 AM
Hi,
I took a look at your instance i-5f20f92e and your server is not accepting connections on port 80 but is on port 22.
Your security groups are open, the problem appears to be within your instance.
Please check your instance to see what you have blocking port 80, or if its set to accept traffic.
Regards,
Stephen
Re: Unable to access webserver running on my amazon ec2 instance
Posted on: Apr 18, 2018 5:36 AM
Instance 36f1ea40d2df4ae090e938962f4349ad
Apache server is running ('httpd (pid 2556) is running..') but cannot reach from browser.
Inbound security rules are ok (HTTP port 80).
Worked fine yesterday, today not.
What might be the problem?
Re: Unable to access webserver running on my amazon ec2 instance
Posted on: Jun 19, 2018 4:57 PM
I am running webserver(IIS8) on my amazon ec2 instance. I can browse it with localhost but not able to access with IP address or the hostname within the server. Both inbound and outbound set to allow all on security groups. is there anything i am missing to configure?
Any help would be greatly appreciated.
Thanks
Sudheer
Reply to this Thread
Answered question
Unanswered question with answer points still available
Unanswered question
Ace: 2000+ pts
Expert: 750-1999 pts
Guide: 300-749 pts
Enthusiast: 50-299 pts
Newbie: 5-49 pts
Amazonian

Ansible is an open-source software provisioning, configuration management, and application-deployment tool. It is one of the most powerful enough to automate complex multi-tier IT application environments. To know more about Ansible you can go through this post >> What is Ansible and How it is so Powerful?

How to set Ansible?

Apache web server windows 10

I have already created a post where you can learn how to set up the ansible successfully and we also troubleshoot some of the problems. Incase if there any error occurred you can comment down below or can connect with me over the social media handle as well. To know the setup part you can go through this post >> How to setup Ansible in RHEL8?

Task Description

We are going to create one Ansible playbook that will set the following set up:

  • Provision an EC2 instance on AWS.
  • Fetch the public IP using the EC2 dynamic inventory concept.
  • Configure webserver.

Apache Web Server Download

Prerequisite

Before going further to solve the task we need some additional setup. I already installed the Ansible on my RHEL8 system.

Apache Web Server Aws Tutorial

  • We need one IAM role in AWS so that Ansible can log in and do the required set up.
  • Boto and Boto3 library of python. To install the library we can use “pip install boto” and “pip install boto3“. This will install the boto library and that library will automatically source the AWS API credential for EC2 instances and IAM roles.
  • To provide the AWS credential we have multiple ways and one of them is by providing through the below command
  • Ansible dynamic inventory file. Now you need two files EC2.py script and the EC2.ini config file. The EC2.py is written using the Boto EC2 library and will query AWS for your running Amazon EC2 instances. The EC2.ini file is the config file for EC2.py and can be used to limit the scope of Ansible’s reach. You can specify the regions, instance tags, or roles that the EC2.py script will find.

In order to get the above files, you can follow below link

To download this through command you can use wget<url>. Now we have to make it executable and to do so we can use below command

Apache web server aws server

Aws Apache Server

As for the Linux user there, one more thing I have to change is in the ec2.py file where we have to make some changes in the header path of the python interpreter. Earlier it is #!usr/bin/python and we have to convert it as #!usr/bin/python3.

now we have to add the location of above both files in our configuration as above our inventory file.

Let’s come to our task. Before going to the task I would like to tell you that in this task i am going to use some technical terms of AWS and in case you don’t know you can go through my AWS posts.

Code

Provision an EC2 instance on AWS

To provision this I created a role and named that as task2

For creating the key pair for the task through the below code and also saved the key locally.

WebAws apache server

To create the security group

To create the EC2 instance

This will launch an instance over AWS and also set the inventory dynamically in our inventory file of Ansible. Our first and second step is done now we will set the webserver.

Configuring Webserver

To configure this I created another role name as web

Apache Web Server Aws Server

To install the apache web server we need python3 so we install that first

Now to launch the apache webserver we will use

This will install the web server and copy the code from the url and start the httpd service.

Apache Web Server Tutorial

Now to run both the roles I created one playbook aws.yml

Now after running this our whole set up will be ready and here is some result of that.

Wordpress

To get the whole code you can go through Github >> https://github.com/anubhavsinghgtm/aws-ansible-dynamic-inventory

In case of any query, you can comment down below or connect with me over.

Apache Web Server Aws

VISIT OUR WEBSITE BRIGHTERBEES FOR MORE INTERESTING STUFFS ABOUT LEARNING.

IF YOU WANT TO KNOW ABOUt DATA SCIENCE click here.

Thank you

Related