Skip to content

Instantly share code, notes, and snippets.

@faizalmansor
Created August 15, 2016 06:56
Show Gist options
  • Save faizalmansor/fddd4bda9dd02e49bf5b4b8a94c0e14e to your computer and use it in GitHub Desktop.
Save faizalmansor/fddd4bda9dd02e49bf5b4b8a94c0e14e to your computer and use it in GitHub Desktop.
Nginx configuration for customized single domain Yii2 advanced template
server {
listen 80;
server_name example.localhost;
root /vagrant/frontend/www;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
location ~ \.php$ {
include fastcgi.conf;
}
}
location /admin {
return 301 /admin/;
}
location /admin/ {
alias /vagrant/backend/www/;
try_files $uri $uri/ @handler;
location ~ \.php$ {
include fastcgi.conf;
}
}
location @handler {
rewrite / /admin/index.php?$args;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment