-
-
Save NorthTexasCreative/dc170f99ae2032126b20929310c3be5a to your computer and use it in GitHub Desktop.
Nginx virtual host example for Windows Subsystem for Linux (WSL)
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
# Location: /mnt/c/windows/system32/drivers/etc/hosts | |
127.0.0.1 virtualhost.local www.virtualhost.local |
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
<?php | |
// Location: /mnt/c/server/www/virtualhost.local/html/index.php | |
phpinfo(); |
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
#!/bin/bash | |
# Location: Anywhere | |
sudo ln -s /etc/nginx/sites-available/virtualhost.local.conf /etc/nginx/sites-enabled/virtualhost.local.conf; | |
sudo service nginx restart; |
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
# Location: /etc/nginx/sites-available/virtualhost.local.conf | |
server { | |
listen 80; | |
listen [::]:80; | |
root /mnt/c/server/www/virtualhost.local/html; | |
index index.php index.html index.htm index.nginx-debian.html; | |
server_name virtualhost.local www.virtualhost.local; | |
location / { | |
try_files $uri $uri/ =404; | |
} | |
location ~ \.php { | |
include snippets/fastcgi-php.conf; | |
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; | |
} | |
location ~ /\.ht { | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment