这在Vagrantfile文件中
config.vm.box = "ubuntu/trusty64"
config.vm.network "private_network", ip: "192.168.33.10"
在Windows上托管文件
127.0.0.1 test.loc
127.0.0.1 localhost
我转到地址localhost并写道我无法访问该站点。
结构:
=====================================
vagrant @ vagrant-ubuntu-trusty-64:/ etc / nginx / sites-available $ sudo服务nginx start
vagrant@vagrant-ubuntu-trusty-64:/etc/nginx/sites-available$ sudo service nginx status
* nginx is not running
vagrant@vagrant-ubuntu-trusty-64:/etc/nginx/sites-available$
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
#root /usr/share/nginx/html;
root /vagrant/www;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
vagrant @ vagrant-ubuntu-trusty-64:/ etc / nginx / sites-available $ netstat -tlpn
(No info could be read for "-p": geteuid()=1000 but you should be root.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:47581 0.0.0.0:* LISTEN -
tcp6 0 0 :::111 :::* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -
tcp6 0 0 :::39494 :::* LISTEN
vagrant @ vagrant-ubuntu-trusty-64:/ etc / nginx / sites-available $ nginx -s reload
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2018/12/14 15:04:23 [warn] 1926#0: the "user" directive makes sense only if
the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
2018/12/14 15:04:23 [emerg] 1926#0: "fastcgi_pass" directive is duplicate
in /etc/nginx/sites-enabled/default:62
vagrant@vagrant-ubuntu-trusty-64:/etc/nginx/sites-available$