问题:⼿机访问不了同⼀个局域⽹内的电脑上的⽹站(已解决)1. 问题具体描述不能用于局域网
  我在centos7下搭建好了appache服务器,然后写好了后台程序以及前端⽹页,现在想⽤我的笔记本建⽴⼀个热点,然后⽤我的⼿机连接并访问我的⽹站。我尝试了下,发现要么是不到⽹页,要么是访问⼈数过多或⽆法访问(但在我的电脑上可以访问我的⽹站)。⼼很凉~
2. 期间使⽤的⼯具
  系统是centos7, 服务器是appache, ⽤的是C写了CGI后台程序,⽤HTML5写了前端⽹页。
3. 如何能访问的?
  我考虑到防⽕墙是不是禁⽌了外界对我的⽹站的访问,后来百度下,到了解决办法。
  切换root模式,输⼊shell指令:  firewall-cmd --permanent --add-service=http (意思是防⽕墙永久开放http服务)
  然后,重启firewall-cmd:  firewall-cmd --reload
  另外,下⾯是我f的配置,主要是三部分,⼀个是设置我的wifi热点的监听(毕竟要把我的电脑作为服务器),⼀个是
把/var/www/html开放出来,还有⼀个是/var/www/cgi-bin,
因为我要访问我的⽹页和后台程序。
 部分1
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 10.42.0.1:80  #让服务器监听IP是10.42.0.1,⽹站的端⼝80,这个IP是我的wifi模块的IP
部分2
# Further relax access to the default document root:
<Directory "/var/www/html">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#  Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# /docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#  Options FileInfo AuthConfig Limit
#
AllowOverride None
Order allow,deny
#
# Controls who can get stuff from this server.
#
# Require all granted
Allow from all
</Directory>
部分3
#
# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/var/www/cgi-bin">
AllowOverride None
Options ExecCGI  #执⾏CGI
Order allow,deny
Allow from all
AddHandler default-handler .css
</Directory>
更改配置后,重启appache服务器: systemctl restart httpd 4. 备注
  如果有什么问题,多多指教,谢谢。

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。