1

I have Ubuntu 32 bit AMI(amazon machine image) on amazon cloud.

I have installed the LAMP stack on it.

apache:  2.4.7
mysql: 5.5.38
php: 5.5.9

Above are specification for A-M-P

Then I got the one public IP address.(x.x.x.x)

Now I need to create the multiple ports.

LIKE x.x.x.x:81 x.x.x.x:82

is it possible??

I have done some steps for the ports configuration as follows:

  1. vim /etc/apache2/ports.conf ==> add line Listen 81
  2. in virtual host file
  <VirtualHost *:81>
            -------
  </VirtualHost>
  1. vim /etc/apache2/hosts ==> added line 127.0.0.1 vhost_name
  2. sudo a2ensite vhost_file_name.conf
  3. sudo /etc/init.d/apache2 restart
Pankaj Badukale
  • 1,991
  • 2
  • 18
  • 32
  • Yes, Look at the apache [Listen](http://httpd.apache.org/docs/current/bind.html) directive. You will also have to open the ports on any software firewall that you have installed and on the ec2 security group. – datasage Oct 16 '14 at 15:22
  • I have updated my question. I have added steps I have taken for ports configuration. I got your point about the firewall. But can you please add steps to do it. I am new for the amazon server configurations. – Pankaj Badukale Oct 16 '14 at 16:14
  • Steps to add rules to security groups of an instance http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html#adding-security-group-rule – Guy Oct 17 '14 at 06:30

1 Answers1

2

Follow these instructions:

EC2 Instance

Update Apache

File: /etc/apache2/ports.conf

Listen 80 
Listen 81

Listen xx where xx is a valid port number

Add/Update Virtual Host

  • Create a virtual host that listens to 81 or the port number that Apache is listening to.
  • Enable the site with sudo a2ensite name of the conf without .conf
  • Restart the apache sudo service apache2 restart

Amazon Console

  • Find the security group of the instance on the instances list.
  • Go to Security Group (find it on the LHS meun) and add the rules to allow the external world to talk to the port numbers your apache is listening to. Please follow this link to add the rules.
Rakesh Sankar
  • 9,337
  • 4
  • 41
  • 66
  • thanks, for those who looking for this answer, here's a related guide on how to allow external world to talk to the port with security group setup: https://stackoverflow.com/questions/26338301/ec2-how-to-add-port-8080-in-security-group?answertab=votes#tab-top – jihchuan Sep 04 '17 at 03:53