Skip to content

Instantly share code, notes, and snippets.

@chibaye
Forked from natanfelles/domain.tld.conf
Created May 20, 2019 15:11
Show Gist options
  • Save chibaye/19b21c2b1cb1636bb786da86048324ad to your computer and use it in GitHub Desktop.
Save chibaye/19b21c2b1cb1636bb786da86048324ad to your computer and use it in GitHub Desktop.
Nginx Virtual Host example to work on localhost
# Location: /etc/nginx/sites-available/domain.tld.conf
server {
listen 80;
# listen 443 ssl;
# include snippets/snakeoil.conf;
root /var/www/domain.tld/public;
index index.html index.php;
server_name domain.tld www.domain.tld;
location / {
try_files $uri $uri/ /index.php;
}
location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
expires max;
log_not_found off;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
location ~ /\. {
deny all;
}
}
# Location: /etc/hosts
127.0.0.1 localhost
127.0.0.1 domain.tld
<?php
// Location: /var/www/domain.tld/public/index.php
phpinfo();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment