Skip to content

Instantly share code, notes, and snippets.

@mrofi
Created August 25, 2016 09:13
Show Gist options
  • Save mrofi/ab7efd961ca1cbca5c482ad9ae814bb0 to your computer and use it in GitHub Desktop.
Save mrofi/ab7efd961ca1cbca5c482ad9ae814bb0 to your computer and use it in GitHub Desktop.
Set up Automatic Virtual Hosts with Nginx
#/etc/nginx/sites-available/default
server {
listen 80;
server_name ~^(www\.)?(?<sname>.+?).dev$;
root /home/mokhamad/html/suit/$sname/public;
location ~ /.well-known {
allow all;
}
# ssl_certificate /etc/letsencrypt/live/servername.com/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/servername.com/privkey.pem;
access_log /var/log/nginx/$sname.access.log;
error_log /var/log/nginx/suitdev.error.log;
include /etc/nginx/index.php.conf;
#include /etc/nginx/ssl.conf;
}
#/etc/hosts
127.0.0.1 localhost
127.0.0.1 *.dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment