導入
ポートフォワーディング
Vagrantfileの以下の行のコメントを外すか、行がなければ記述。
1 |
config.vm.network "forwarded_port", guest: 80, host: 8080 |
Vagrantfile修正後はVagrantを再起動。
1 2 3 4 |
C:\vagrant\centos7>vagrant reload ==> default: Attempting graceful shutdown of VM... ..... C:\vagrant\centos7>vagrant ssh |
httpdの状態確認と起動
httpdの稼働状況を確認。
1 2 3 4 5 6 7 |
[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; vendor preset: disabled) Active: inactive (dead) Docs: man:httpd(8) man:apachectl(8) |
停止しているなら起動。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
[vagrant@localhost ~]$ sudo service httpd start Redirecting to /bin/systemctl start httpd.service [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; vendor preset: disabled) Active: active (running) since 日 2021-07-25 15:57:37 JST; 4s ago Docs: man:httpd(8) man:apachectl(8) Main PID: 19378 (httpd) Status: "Processing requests..." CGroup: /system.slice/httpd.service ├─19378 /usr/sbin/httpd -DFOREGROUND ├─19379 /usr/sbin/httpd -DFOREGROUND ├─19380 /usr/sbin/httpd -DFOREGROUND ├─19381 /usr/sbin/httpd -DFOREGROUND ├─19382 /usr/sbin/httpd -DFOREGROUND └─19383 /usr/sbin/httpd -DFOREGROUND 7月 25 15:57:36 localhost.localdomain systemd[1]: Starting The Apache HTTP Server... 7月 25 15:57:36 localhost.localdomain httpd[19378]: AH00558: httpd: Could not reliably determine the serve...age 7月 25 15:57:37 localhost.localdomain systemd[1]: Started The Apache HTTP Server. Hint: Some lines were ellipsized, use -l to show in full. |
接続確認
ホストのブラウザーからlocalhost:8080
にアクセス。