TUTORIAL: How to Install Apache Web Server in CentOS 7.5 (1805) Linux in Amazon AWS Cloud with URL/HTTP/HTTPS Redirection
AUTHOR OF THIS TUTORIAL: MR. TURRITOPSIS DOHRNII TEO EN MING (ZHANG ENMING) @ TIME TRAVELLER AGE: 40 YEARS OLD COUNTRY OF RESIDENCE: SINGAPORE DATE: 30TH AUGUST 2018 THURSDAY TIME: 10:49 AM SINGAPORE TIME Greenwich Mean Time+8
1. Sign up for Amazon AWS Cloud or Google Cloud Platform or Microsoft Azure Cloud or Ali Baba Cloud account (your preference).
2. Login to Amazon AWS Management Console.
3. Click EC2 under Compute.
4. Click Elastic IPs under Network and Security.
5. Click Allocate New Address.
6. Click the Allocate button.
7. You will receive a permanent public IPv4 address from Amazon AWS Cloud, eg. 18.223.148.223. Alternative IPv4 address: 18.220.9.93. IPv6 address is not applicable.
8. Click Instances under INSTANCES.
9. Click Launch Instance.
10. Click AWS Marketplace.
11. Search for CentOS in the Search box. Press ENTER.
12. Select CentOS 7 (x86_64) - with Updates HVM 1805_1 Amazon Machine Image (AMI).
13. Click Continue.
14. Select General purpose, t2.micro, 1 vCPU, 1 GB RAM (FREE TIER ELIGIBLE).
15. Click Next: Configure Instance Details.
16. Select Network: <Your VPC network>.
17. Select Subnet: <Your subnet> | Public subnet | us-east-2a.
18. Click Protect against accidental termination.
19. Click Next: Add Storage.
20. Click Next: Add Tags.
21. Click Next: Configure Security Group.
22. Click Select an existing security group.
23. Select VS_SG (Virtual Server Security Group).
24. Click Review and Launch.
25. Click Launch.
26. Select a Secure Shell (SSH) key pair.
27. Click Launch Instances.
28. Click Elastic IPs under Network and Security.
29. Select the Elastic IP 18.223.148.223.
30. Click Actions.
31. Click Associate address.
32. Select the Instance you have created previously.
33. Click Allow Elastic IP to be reassociated if already attached.
34. Click Associate.
35. Open Putty/SSH client and login to CentOS 7.5 (1805).
36. Login as username centos.
37. Sign Out from Amazon AWS Management Console.
38. Install Apache web server with the Secure Sockets Layer (SSL) module:
sudo yum install httpd mod_ssl
39. Start the Apache web server process:
sudo /usr/sbin/apachectl start
40. Visit and test your web server at 18.223.148.223 Using Google Chrome.
41. You should see an Apache Web Server test page.
42. Install the nano text editor in Linux:
sudo yum install nano
43. Go to the main Apache web server configuration directory:
cd /etc/httpd/conf
44. Edit the main Apache web server configuration file:
sudo nano httpd.conf
45. Append the following code to the end of httpd.conf:
<VirtualHost *:80> ServerName blogger.teo-en-ming.com Redirect / https://tdtemcerts.blogspot.sg </VirtualHost>
Alternative Code:
<VirtualHost *:80> ServerName wordpress.teo-en-ming.com Redirect / https://tdtemcerts.wordpress.com </VirtualHost>
46. Restart the Apache web server process:
sudo /usr/sbin/apachectl restart
47. Open an Internet Protocol Security (IPsec) Virtual Private Networking (VPN) connection to your corporate network using Shrew Soft VPN client.
48. Open a Remote Desktop Connection to your Windows Server 2019 Active Directory Domain Controller.
49. Under Server Manager, click Tools. Then Click DNS (Domain Name Service).
50. Click Forward Lookup Zones.
51. Click TEO-EN-MING.COM
52. Right Click, select New Host (A or AAAA).
53. Fill in Hostname: blogger
54. Fill in IP address: 18.223.148.223
55. Click Add Host.
56. Alternative DNS Host Record:
Fully Qualified Domain Name (FQDN): WORDPRESS.TEO-EN-MING.COM IP address: 18.220.9.93
57. Test http://blogger.teo-en-ming.com. It should redirect to https://tdtemcerts.blogspot.sg
58. Alternative test: http://wordpress.teo-en-ming.com. It should redirect to https://tdtemcerts.wordpress.com
59. Go to Apache web server alternative configuration directory:
cd /etc/httpd/conf.d
60. Edit the Apache web server Secure Socket Layer (SSL) configuration file:
sudo nano ssl.conf
61. Find the section that says <VirtualHost _default_:443>
62. Insert the following code:
ServerName blogger.teo-en-ming.com Redirect / https://tdtemcerts.blogspot.sg
Alternative Code:
ServerName wordpress.teo-en-ming.com Redirect / https://tdtemcerts.wordpress.com
63. Restart the Apache web server process:
sudo /usr/sbin/apachectl restart
64. Test https://blogger.teo-en-ming.com. It should redirect to https://tdtemcerts.blogspot.sg
65. Alternative test: https://wordpress.teo-en-ming.com. It should redirect to https://tdtemcerts.wordpress.com
66. USEFUL REFERENCES:
(A) Article: Install Apache and PHP on CentOS 6
Link/URL: https://support.rackspace.com/how-to/centos-6-apache-and-php-install/
(B) Article: How To Create Temporary and Permanent Redirects with Apache and Nginx
Link/URL: https://www.digitalocean.com/community/tutorials/how-to-create-temporary-and...
67. Exit Putty/SSH client.
68. END OF TUTORIAL.
===BEGIN SIGNATURE=== Turritopsis Dohrnii Teo En Ming's Academic Qualifications as at 30 Oct 2017 [1] https://tdtemcerts.wordpress.com/ [2] http://tdtemcerts.blogspot.sg/ [3] https://www.scribd.com/user/270125049/Teo-En-Ming ===END SIGNATURE===
On Aug 29, 2018, at 23:17, Turritopsis Dohrnii Teo En Ming turritopsis.dohrnii@teo-en-ming.com wrote:
sudo /usr/sbin/apachectl start
On CentOS 7 you really should run:
$ sudo systemctl start httpd.service
That way the service is managed by systemd and gets the appropriate cgroups and contexts. You also do nothing to ensure the httpd.service unit starts on boot. You need to run:
$ sudo systemctl enable httpd.service
— Jonathan Billings billings@negate.org
--On Thursday, August 30, 2018 4:17 AM +0000 Turritopsis Dohrnii Teo En Ming turritopsis.dohrnii@teo-en-ming.com wrote:
- Go to the main Apache web server configuration directory:
cd /etc/httpd/conf
- Edit the main Apache web server configuration file:
sudo nano httpd.conf
- Append the following code to the end of httpd.conf:
<VirtualHost *:80> ServerName blogger.teo-en-ming.com Redirect / https://tdtemcerts.blogspot.sg
</VirtualHost>
Alternative Code:
<VirtualHost *:80> ServerName wordpress.teo-en-ming.com Redirect / https://tdtemcerts.wordpress.com
</VirtualHost>
================================================================
No. Use the packaging system to avoid editing distribution-provided files. Avoid editing /etc/httpd/conf/httpd.conf. In this case, add new files under /etc/httpd/conf.d for each virtual host. You could name them blogspot.conf and wordpress.conf.
================================================================
- Go to Apache web server alternative configuration directory:
cd /etc/httpd/conf.d
- Edit the Apache web server Secure Socket Layer (SSL) configuration
file:
sudo nano ssl.conf
Find the section that says <VirtualHost _default_:443>
Insert the following code:
ServerName blogger.teo-en-ming.com Redirect / https://tdtemcerts.blogspot.sg
Alternative Code:
ServerName wordpress.teo-en-ming.com Redirect / https://tdtemcerts.wordpress.com
================================================================
Same issue here. I hate that ssl.conf includes both general SSL settings and a vhost. Split the vhost into its own file and make your edits there.
Don't remove ssl.conf entirely or the next "yum update" will restore the default version! (Yeah, I've been burned by that.) If you really want to remove that file without removing the module, replace it with an empty file so yum won't re-install the default one at the next update.
================================================================