zoukankan      html  css  js  c++  java
  • apache配置局域网访问

    1.配置vhost.conf

    NameVirtualHost 192.168.2.74:80
    <VirtualHost 192.168.2.74:80>
        DocumentRoot /var/www/html/localhost/public_html
        ServerName 192.168.2.74
        ServerAdmin example@gmail.com
        ErrorLog "|rotatelogs /var/www/html/localhost/log/error_%Y_%m_%d.log 86400 480"
        CustomLog "|rotatelogs /var/www/html/localhost/log/access_%Y_%m_%d.log 86400 480" common
    </VirtualHost>
    

    2.配置httpd.conf

    <Directory />
        AllowOverride None 
        Options None 
        Order allow,deny
        Allow from all
    </Directory>
    

      

    3.配置防火墙规则

    /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
    /etc/rc.d/init.d/iptables save
    

    注:删除规则的方法:

    先找到规则的编号,然后按编号删除
    $iptables -nvL --line-numbers
    Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
    num   pkts bytes target     prot opt in     out     source               destination         
    1        0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:80 
    2      495 39735 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
    3        0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           
    4        0     0 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0           
    
    $iptables -D INPUT 1
    $/etc/rc.d/init.d/iptables save
    

    4.重启httpd服务

    service httpd restart 
    
  • 相关阅读:
    lua 与 c 的相互调用
    平台认证 & HTTP 302 重定向
    1. 个人经验总结
    Java反编译
    1. 个人经验总结
    3. 技术专题
    Office
    工作机的目录组织
    Eclipse
    Eclipse中的Gradle集成
  • 原文地址:https://www.cnblogs.com/tiger2soft/p/5669848.html
Copyright © 2011-2022 走看看