Release other Amazon HTTP ports [closed]
want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 2 years ago .
improve this questionHello,
I am setting up a server on Amazon where I would like to have multiple sites on the same instance.
I configured on the IIS server each site on a port, but the firewall from Amazon only allows me to access port 80 from outside.
3 answers
Amazon calls its firewall Security Group.
You can reach this option from the dashboard by following:
Note the INBOUND and OUTBOUND tabs. INBOUND is where the input rules are, that is, the ports that will be open for access to your server. Outbound are the exit rules.
To edit ports inbound, you must select the INBOUND tab and trigger the EDIT button. Then trigger the ADD RULE button and then assemble your rule. Type receives the input protocol type, PORT-RANGE is the designation of the port number or Numbers, and SOURCE defines who can use the rule (CUSTOM IP, ANYWHERE, my IP). The difference from MY IP to CUSTOM IP is that it automatically populates with your public IP.
Check the security group associated with the instance, in it you can authorize other ports and sources.
Friend, to host multiple sites on the same instance it is not necessary to open ports. You can leave the default 80. If your server is ubuntu or linux-amazon just create the virtual host and point to the folder of your project.
Example:
Imagine that you have the 2 domains
www.site1.com.br
www.site2.com.br
For linux
Open the file /etc/hosts
With the following command
nano /etc/hosts
And type this line in the file
127.0.0.1 www.site1.com.br
127.0.0.1 www.site2.com.br
Hello and close the file
Run the command cd /etc/apache2/sites-available
after ls
You noticed that in this folder you have a file with the name 000-default.conf
Run the command cp 00-default.conf vhost.conf
,
this command will copy the file to another as the name vhost.conf
Then Delete All information from this file and add the code
<VirtualHost *:80>
ServerName www.site1.com.br
DocumentRoot "/var/www/site1
<Directory "/var/www/site1">
AllowOverride all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName www.site2.com.br
DocumentRoot "/var/www/site2"
<Directory "/var/www/site2">
AllowOverride all
</Directory>
</VirtualHost>
Save and close the file.
Run the a2ensite vhost.conf
command to enable vhost
Then service apache2 restart
to restart apache and you're done
The example above is for servers with ubuntu OS. if it is linux-amazon the process is the same with change in commands.