Reference:
Category Archives: AWS
Create Virtual host on EC2 (ubuntu)
Steps
- sudo mkdir -p /var/www/rex.com/
- sudo chown -R ubuntu:www-data /var/www/rex.com/
- sudo chmod -R 755 /var/www/
- cd /etc/apache2/sites-available/
sudo cp 000-default.conf rex.com.conf
sudo nano rex.com.conf - sudo a2ensite rex.com.conf
- sudo service apache2 restart
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<VirtualHost *:80> ServerName lab.com ServerAlias www.lab.com ServerAdmin root@localhost DocumentRoot "/var/www/lab" <Directory /> AllowOverride none Require all denied </Directory> <Directory "/var/www/lab"> Options Indexes FollowSymLinks AllowOverride all Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/lab-error.log CustomLog ${APACHE_LOG_DIR}/lab-access.log combined RewriteEngine on RewriteCond %{SERVER_NAME} = www.lab.com RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent] </VirtualHost> |
Reference:
Install and Enable mbstring module on AWS EC2
Install mbstring:
1 |
sudo yum install php56-mbstring |
Enable mbstring module
1 2 3 4 5 |
//Open php.ini sudo nano /etc/php.ini //Append or uncomment extension line extension=php_mbstring.dll |
Restart apache:
1 |
sudo service httpd restart |
Reference:
Grant EC2 the permission to install plugins without FTP setting
- Change permisson:
1sudo chmod -R 775 /var/www/html/wp-content - Update wp-config.php:
1define('FS_METHOD', 'direct');
Reference:
Edit and reload php.ini
Possible path:
1 2 |
sudo nano /etc/php.ini sudo vim /etc/php5/apache2/php.ini |
Commands to load new php.ini
1 2 3 4 5 6 7 8 |
//Restawrt web server sudo service httpd restart. //Restart web server sudo service apache2 restart //Reload all config (.ini) files service apache2 reload |
Reference:
Edit config file of Apache on Amazon Linux
Find the path of httpd.conf
ps -ef | grep apache
/usr/sbin/apache2 -V
Reference: http://www.commanigy.com/blog/2011/06/08/finding-apache-configuration-file-httpd-conf-location
Edit httpd.conf
sudo nano /etc/httpd/conf/httpd.conf
Reference:
- http://linux.vbird.org/linux_basic/0220filemanager.php
- http://linux.vbird.org/linux_basic/0160startlinux.php#nano
- http://stackoverflow.com/questions/15112424/how-to-edit-httpd-conf-file-in-amazon-ec2
- http://jafty.com/blog/enable-mod_rewrite-on-apache-ec2-linux-server/
Restart Apache
sudo service httpd restart
Upload Files to S3
S3 Browser:
Reference:
AWS Web Server Failed to Connect Database
The solution was to run
setsebool -P httpd_can_network_connect=1