- https://aws.amazon.com/ec2/pricing/on-demand/
- Resize Amazon EC2 Boot Disk
- Resize EC2 file system with LVM
- Amazon EC2 disk resize No space left on device
- Cpanel Server Behind NAT (Amazon AWS)
- Cpanel Server Behind NAT – Amazon EC2
- Amazon Ec2 Fixing Cpanel IP after restore from snapshot
- How to Open Port in Amazon EC2 instance
Tag: Amazon EC2
-
Amazon EC2
-
Enable Gzip in Amazon Linux
To verify Apache module is loaded, run
[root@ip-172-31-29-220 ~]# apachectl -M | grep deflate deflate_module (shared) [root@ip-172-31-29-220 ~]#
Create file
vi /etc/httpd/conf.d/gzip.conf
Add following content
# Restrict compression to these MIME types AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xml+rss AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE text/javascript AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE image/png AddOutputFilterByType DEFLATE image/gif AddOutputFilterByType DEFLATE image/jpeg # Level of compression (Highest 9 - Lowest 1) DeflateCompressionLevel 9 # Netscape 4.x has some problems. BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.06-4.08 have some more problems BrowserMatch ^Mozilla/4\.0[678] no-gzip # MSIE masquerades as Netscape, but it is fine BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html # Make sure proxies don't deliver the wrong content Header append Vary User-Agent env=!dont-vary Restart Apache with
service httpd restart
To verify gzip is working, run
curl -I -H 'Accept-Encoding: gzip,deflate' http://YOUR-SITE-URL/ 2>/dev/null | grep gzip
You will see something like
NOTE: gzip compression only works if you have a reasonably large file. If your file is very small, then gzip won’t do anything.
See gzip
-
Cpanel Server Behind NAT – Amazon EC2
When your cpanel server is behind nat, for example Amazon EC2 where you have an internal IP and External IP.
Go to
Home > Server Configuration> Basic WebHost Manager® Setup
Enter your servers internal IP where it ask for “The IPv4 address (only one address) to use to set up shared IPv4 virtual hosts.”.
Now login to Server using SSH and run
/scripts/build_cpnat
For an Amazon EC2 server with internal IP 172.31.26.120, i added the IP in WHM > Basic WebHost Manager® Setup
Run command /scripts/build_cpnat
That associate the IP with external IP address.
[root@ip-172-31-26-120 ~]# /scripts/build_cpnat info [build_cpnat] 172.31.26.120 => 13.210.58.114 [root@ip-172-31-26-120 ~]#
This allow DNS and Apache to resolve external IP properly. With out running this command DNS server will just reply with servers internal IP address.