流浪者:192.168.33.10 拒绝连接 [英] Vagrant: 192.168.33.10 refused to connect

查看:29
本文介绍了流浪者:192.168.33.10 拒绝连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我用vagrant在虚拟机上安装了centOS6,还安装了httpd和php.

Hi, I installed centOS6 in virtual machine by vagrant and also installed httpd and php.

但是,当我尝试访问 http://192.168.33.10 这是我设置的 IP 地址时Vagrantfile,我打不开网页.

But, when I try to access to http://192.168.33.10 which is the ip address I set in the Vagrantfile, I can't open a webpage.

我在/var/www/html 目录下做了一些文件.

I made some files under /var/www/html directory.

$ cd /var/www/html/
$ ls
index.html  test.php

这是我在 Vagrantfile 中更改设置的地方

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine.
  config.vm.network "forwarded_port", guest: 80, host: 8080

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  config.vm.network "private_network", ip: "192.168.33.10"

httpd 正在运行

$ which httpd
/usr/sbin/httpd


[vagrant@localhost ~]$ sudo service httpd status
Redirecting to /bin/systemctl status  httpd.service
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)
   Active: active (running) since Sun 2016-05-08 18:44:38 EDT; 53s ago
     Docs: man:httpd(8)
           man:apachectl(8)
 Main PID: 3180 (httpd)
   Status: "Total requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec"
   CGroup: /system.slice/httpd.service
           ├─3180 /usr/sbin/httpd -DFOREGROUND
           ├─3181 /usr/sbin/httpd -DFOREGROUND
           ├─3182 /usr/sbin/httpd -DFOREGROUND
           ├─3183 /usr/sbin/httpd -DFOREGROUND
           ├─3184 /usr/sbin/httpd -DFOREGROUND
           └─3185 /usr/sbin/httpd -DFOREGROUND

May 08 18:44:37 localhost.localdomain httpd[3180]: AH00558: httpd: Could not reliably determine the server's fully qualifie...ssage
May 08 18:44:38 localhost.localdomain systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.

我对网络不太了解.

我该如何解决这个问题?谁能教教我!

How can I fix this problem? Could anyone please teach me!

    # -*- mode: ruby -*-
    # vi: set ft=ruby :

    # All Vagrant configuration is done below. The "2" in Vagrant.configure
    # configures the configuration version (we support older styles for
    # backwards compatibility). Please don't change it unless you know what
    # you're doing.
    Vagrant.configure(2) do |config|
      # The most common configuration options are documented and commented below.
      # For a complete reference, please see the online documentation at
      # https://docs.vagrantup.com.

      # Every Vagrant development environment requires a box. You can search for
      # boxes at https://atlas.hashicorp.com/search.
      config.vm.box = "centOS70_64"

      # Disable automatic box update checking. If you disable this, then
      # boxes will only be checked for updates when the user runs
      # `vagrant box outdated`. This is not recommended.
      # config.vm.box_check_update = false

      # Create a forwarded port mapping which allows access to a specific port
      # within the machine from a port on the host machine. In the example below,
      # accessing "localhost:8080" will access port 80 on the guest machine.
      config.vm.network "forwarded_port", guest: 80, host: 8080

      # Create a private network, which allows host-only access to the machine
      # using a specific IP.
      config.vm.network "private_network", ip: "192.168.33.10"

      # Create a public network, which generally matched to bridged network.
      # Bridged networks make the machine appear as another physical device on
      # your network.
      # config.vm.network "public_network"

      # Share an additional folder to the guest VM. The first argument is
      # the path on the host to the actual folder. The second argument is
      # the path on the guest to mount the folder. And the optional third
      # argument is a set of non-required options.
      # config.vm.synced_folder "../data", "/vagrant_data"

      # Provider-specific configuration so you can fine-tune various
      # backing providers for Vagrant. These expose provider-specific options.
      # Example for VirtualBox:
      #
      # config.vm.provider "virtualbox" do |vb|
      #   # Display the VirtualBox GUI when booting the machine
      #   vb.gui = true
      #
      #   # Customize the amount of memory on the VM:
      #   vb.memory = "1024"
      # end
      #
      # View the documentation for the provider you are using for more
      # information on available options.

      # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
      # such as FTP and Heroku are also available. See the documentation at
      # https://docs.vagrantup.com/v2/push/atlas.html for more information.
      # config.push.define "atlas" do |push|
      #   push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
      # end

      # Enable provisioning with a shell script. Additional provisioners such as
      # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
      # documentation for more information about their specific syntax and use.
      # config.vm.provision "shell", inline: <<-SHELL
      #   sudo apt-get update
      #   sudo apt-get install -y apache2
      # SHELL
    end

附加信息 - 我在执行 vagrant up 时得到的信息.

% vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 80 (guest) => 8080 (host) (adapter 1)
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default:
    default: Guest Additions Version: 4.3.14
    default: VirtualBox Version: 5.0
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => /Users/Hayato/Dropbox/vagrant/centOS65
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.

推荐答案

第一:使用fix IP时不需要转发端口;确实,您将直接从您的固定 IP 访问 80 端口

first: you do not need to forward port when you use fix IP; indeed you will reach the 80 port directly from your fixed IP

所以删除转发端口并重试.

so remove the forward port and retry.

第二:不清楚以下错误

5 月 8 日 18:44:37 localhost.localdomain httpd[3180]:AH00558:httpd:无法可靠地确定服务器的完全合格...ssage

May 08 18:44:37 localhost.localdomain httpd[3180]: AH00558: httpd: Could not reliably determine the server's fully qualifie...ssage

您是否在 conf 文件中使用 localhost 作为服务器名称?如果您确实将其删除并让 apache 进行配置和绑定

are you using localhost as server name in your conf file ? if you do remove it and let apache do the configuration and binding

这篇关于流浪者:192.168.33.10 拒绝连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆