# Create a subdomain on AWS EC2 (Apache2) sudo mkdir -vp /var/www/vhosts/myapp.io/httpdocs sudo chown -R ec2-user:apache /var/www/vhosts/myapp.io/httpdocs mkdir -vp /var/www/vhosts/myapp.io/logs sudo chown -R ec2-user:apache /var/www/vhosts/myapp.io/logs sudo touch /etc/httpd/sites-enabled/myapp.io.conf ``` ServerName myapp.io ServerAlias *.myapp.io DocumentRoot /var/www/vhosts/myapp.io/httpdocs/ RewriteEngine On # especially where AWS ALB is used RewriteCond %{HTTP:X-Forwarded-Proto} =http RewriteRule .* https://%{HTTP:Host}%{REQUEST_URI} [L,R=permanent] Options -Indexes +FollowSymLinks +MultiViews AllowOverride All Require all granted # revisit this config php_admin_value open_basedir "/var/www/vhosts/myapp.io/httpdocs/:/tmp/:/" ErrorLog /var/www/vhosts/myapp.io/logs/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/www/vhosts/myapp.io/logs/access.log combined ``` sudo touch /var/www/vhosts/myapp.io/httpdocs/index.html sudo printf 'myapp.io' > /var/www/vhosts/myapp.io/httpdocs/index.html sudo service httpd restart