Skip to content

Instantly share code, notes, and snippets.

@pinstorm
Last active June 27, 2019 17:13
Show Gist options
  • Save pinstorm/5b48f9e19569101229fc7d2d2a15aee5 to your computer and use it in GitHub Desktop.
Save pinstorm/5b48f9e19569101229fc7d2d2a15aee5 to your computer and use it in GitHub Desktop.
# 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
```
<VirtualHost *:80>
ServerName myapp.io
ServerAlias *.myapp.io
DocumentRoot /var/www/vhosts/myapp.io/httpdocs/
<Directory /var/www/vhosts/myapp.io/httpdocs/>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
php_admin_value open_basedir "/var/www/vhosts/myapp.io/httpdocs/:/tmp/:/"
</Directory>
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
</VirtualHost>
```
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment