Horje
Create subdomain | Nginx | Fish Shell Code Example
Create subdomain | Nginx | Fish Shell
set subdomain "apps.example.com"
# Create directory
sudo mkdir /var/www/$subdomain
# Create index.html
sudo vim /var/www/$subdomain/index.html

# 1. Copy the default config for the new subdomaine
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/$subdomain
sudo ln -s /etc/nginx/sites-available/$subdomain /etc/nginx/sites-enabled/$subdomain
  
# 2. Open the config file
sudo echo "<h1>Subdomain Works!</h1>" > /etc/nginx/sites-available/$subdomain
  
# 3. Edit the file
# The content should look something like this
server {
        listen 80;
        listen [::]:80;
        root /var/www/apps;
        index index.html;
        server_name apps.example.com;
}
  
# 4. Restart NGINX
sudo service nginx restart

# Obtain an SSL Certificate
sudo certbot --nginx -d $subdomain




Shell

Related
install avro for linux Code Example install avro for linux Code Example
multiple-gits Code Example multiple-gits Code Example
asdf check node version Code Example asdf check node version Code Example
set up ssh windows 10 Code Example set up ssh windows 10 Code Example
typo3 clearc chace over commandline Code Example typo3 clearc chace over commandline Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
12