LoginSignup
0
0

More than 5 years have passed since last update.

VirtualHostをサーバーにセットする

Posted at

step 1

  • httpd.confを編集

Listen 8000
<VirtualHost *:8000>
    ServerName localhost
    DocumentRoot "/path/to/web/site/"
    ErrorLog "logs/web_site_error_log"
    CustomLog "logs/web_site_access_log" common
</VirtualHost>

step 2

  • iptablesの設定

    vi /etc/sysconfig/iptables
    
  • 次を追加


-A INPUT -p tcp -m tcp --dport 8000 -j ACCEPT

or

  • CMD lineで

    iptables -A INPUT -p tcp --dport 8000 -j ACCEPT
    
  • 問題点:

reject-with icmp-host-prohibited の前に追加する事後になると記述が反映されないようになる 参考

step 3

  • reload
service httpd restart
service iptables restart

/etc/init.d/iptables save # 変更をセーブ

/etc/init.d/iptables stop # 全体的にストップする

Basic認証を与える

  • passwd生成
htpasswd -b -c <file name> <userName> <passWd>
  • httpd.confに追加
<VirtualHost>
    <Directory "/path/to/web/site/">
          AuthUserFile <passwd file path>
          AuthGroupFile /dev/null
          AuthName "Basic Auth"
          AuthType Basic
          Require valid-user
    </Directory>
</VirtualHost>
0
0
0

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
0
0