nginx配置server:
问题:现在执行vagrant up 在/etc/nginx/sites-available 下不会生成配置文件,连default也没有,很奇怪,所以需要手动配置:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /home/www/blog/public; #网站根目录,既index.php入口文件所在目录,结尾不加 /
index index.php index.html;
server_name www.front.test; # 域名或者ip地址
location / {
try_files $uri $uri/ /index.php?$query_string; #larvel优雅连接。请根据实际配置
}
location ~ \.php$ { # 支持php
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock; # 这里对应着上面安装的php7.0
}
}
更改sites-available以后在 /etc/nginx/sites-enabled 目录下建立一个软链接:
ln -s /etc/nginx/sites-available/www.front.test.conf /etc/nginx/sites-enabled/www.front.test.conf
