在我的树莓派 3+我按照说明安装并配置 apache,现在我可以查看:
- 默认 apache 配置为
localhost
,和 - GCI 网页
gci.example.com
配置文件
gci.conf
pi@raspberrypi:~ $ cat /etc/apache2/sites-available/gci.conf
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName gci.example.com
ServerAdmin [email protected]
ServerAlias www.gci.example.com
DocumentRoot /var/www/gci/public_html/
<Directory /var/www/gci/public_html/>
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
hosts
pi@raspberrypi:~ $ cat /etc/hosts
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.1.1 raspberrypi
127.0.0.1 www.gci.example.com
访问localhost
和gci.example.com
我已经使用 PuTTY 通过 SSH 连接到我的 Pi,并且添加了如下隧道:
现在,当我转到时,localhost
我可以看到已配置的默认 apache 页面,但我无法找到该gci
网页。
我尝试使用其他端口,但不起作用。我是 Apache 新手,所以可能做错了什么?
我想/var/www/
使用 PuTTY 或其他工具(如果需要)从我的 Windows 机器访问在我的 Pi 下配置的多个网站。
这些链接链接-1,链接-2建议使用 DNS 设置,但我不明白如何做到这一点。
ifconfig
pi@raspberrypi:~ $ ifconfig
eth0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether b8:27:eb:40:c3:ea txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 33 bytes 15256 (14.8 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 33 bytes 15256 (14.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.102 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::1de9:48e4:f9ed:2850 prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:15:96:bf txqueuelen 1000 (Ethernet)
RX packets 1124 bytes 243059 (237.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 755 bytes 128636 (125.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0