LoginSignup
4

More than 5 years have passed since last update.

VagrantでCentOSにhttpdとphp入れてホストOSからアクセス

Last updated at Posted at 2016-02-10

備忘録

  • 適当にvagrant boxを探す
  • $ vagrant box add "boxname" "URL"
  • $ vagrant init "boxname"
  • Vagrantfileを編集してポートフォワーディングと共有フォルダの設定
config.vm.network "forwarded_port", guest: 80, host: 8080
# config.vm.network "private_network", ip: "192.168.33.10"
# ip の設定でもいける
config.vm.synced_folder "./docroot", "/var/www/html"
  • $ vagrant up
  • $ sudo yum install httpd
  • $ sudo yum install php
  • $ sudo service httpd start
  • $ sudo chkconfig httpd on マシン起動時にhttpd起動
  • http://localhost:8080/

  • php動作テスト
  • <?php phpinfo();

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4