-
Notifications
You must be signed in to change notification settings - Fork 1
Virtual Host
Valentin Ivaşcu edited this page May 27, 2015
·
1 revision
#Create a new site (demo.dev)
Create site document root
mkdir /vagrant/shared/www/demo
Create default index.html
sudo nano /vagrant/shared/www/demo/index.html
and add some text
Create new vhost
sudo nano /etc/nginx/sites-available/demo.dev
and add config
server {
listen 80;
server_name demo.dev www.demo.dev;
root '/vagrant/shared/www/demo';
index index.html index.htm index.php;
charset utf-8;
location / {
try_files \$uri \$uri/ /index.php?\$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/demo-dev-error.log error;
sendfile off;
client_max_body_size 100m;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
location ~ /\.ht {
deny all;
}
}
Enable demo.dev vhost creating a symbolic link
sudo ln -fs "/etc/nginx/sites-available/demo.dev" "/etc/nginx/sites-enabled/demo.dev"
Reload nginx
sudo service nginx reload
and test if http://demo.dev/ is workin` ok!