Vagrant - centos 网络

Vagrant - centos networking

我已经用这个配置设置了一台 Vagrant 机器 --

Vagrant.configure("2") do |config|
  config.vm.box = "intprog/centos7-ez6"
    config.ssh.insert_key = false
    config.vm.network "public_network", ip: "192.168.33.243"
    config.vm.provision "file", source: "/server/bin/nginx/conf/domains-enabled/cemcloudMigration.conf", destination: "~/cemcloud.conf"
    config.vm.provision "shell", path: "webroot/bootstrap/script.sh"
end

这就是我的脚本的样子 -- sudo su

#update the centos version
#yum update -y

yum -y erase httpd httpd-tools apr apr-util
#getting nginx from the right address
yum install -y http://http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.10.0-1.el7.ngx.x86_64.rpm
yum install -y nginx

#installing composer
curl -sS https://getcomposer.org/installer | php
chmod +x composer.phar
mv composer.phar /usr/bin/composer

cd /srv/www/cemcloud2
composer install

#removal of old mariadb5.5 and installation of the new one
yum -y remove mariadb-server mariadb mariadb-libs
yum clean all
yum -y install MariaDB-server MariaDB-client

#clear unnecessary software
yum -y remove varnish

## restart the service
service mysql restart
service php-fpm restart
service nginx restart

/var/log/nginx/access.log 正在生成这个 --

10.0.2.2 - - [17/Oct/2016:11:42:10 +0000] "GET / HTTP/1.1" 301 185 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0" "-"

nginx 的行为非常奇怪,因为它有时会生成日志,有时不会。当我打开我的 firefox 开发人员时,它会生成日志,而当我打开 google chrome 时,它不会。

每次我将 URL 放入浏览器时,它都会显示

the connection has timed out.

无论如何我想连接到这台机器。我究竟做错了什么 ??

这是这台机器内部的防火墙问题 "intprog/centos7-ez6"。它没有监听端口 https。 我遵循了这些步骤:

  1. firewall-cmd --add-service=https
  2. firewall-cmd --add-service=https --permanent
  3. firewall-cmd --reload

一切正常。

请检查您在访客机器上的网络:

nmap -sT -O localhost

检查您在 nginx 配置中使用的端口是否打开。 如果没有,请在防火墙中打开它们并再次检查。