Created
June 20, 2018 08:46
-
-
Save iSWORD/dcd9379dc8eae21772477b91146554d2 to your computer and use it in GitHub Desktop.
.laravel + .localhost TLDs with dynamic nginx configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo 'address=/localhost/127.0.0.1' | sudo tee /etc/NetworkManager/dnsmasq.d/development-tlds > /dev/null | |
echo 'address=/laravel/127.0.0.1' | sudo tee -a /etc/NetworkManager/dnsmasq.d/development-tlds > /dev/null | |
sudo service NetworkManager reload |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Nginx config file for .laravel tlds | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name ~^(?<subdomain>.+)\.laravel$; | |
root /var/www/$subdomain/public; | |
index index.php index.html index.htm; | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
location ~ \.php$ { | |
include snippets/fastcgi-php.conf; | |
fastcgi_pass unix:/run/php/php7.0-fpm.sock; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Nginx config file for .localhost tlds | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name ~^(?<subdomain>.+)\.localhost$; | |
root /var/www/$subdomain; | |
index index.php index.html index.htm; | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
location ~ \.php$ { | |
include snippets/fastcgi-php.conf; | |
fastcgi_pass unix:/run/php/php7.0-fpm.sock; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment