这个问题之前已经被问过了,我只是希望得到一些帮助。 在search论坛和看到别人的post后,我仍然无法得到这个工作。 现在我有端口80上的所有stream量去一台服务器,我正试图连接一个子域与我的networking上的另一个networking服务器。 我很新的networking和做这个项目学习,任何帮助,非常感谢。
主服务器:我正在使用000-default.conf
NameVirtualHost *:80 <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 mydomain.me ServerAdmin webmaster@localhost DocumentRoot /var/www/html # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, eg #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 RewriteEngine on RewriteCond %{SERVER_NAME} =mydomain.me RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] </VirtualHost> <VirtualHost *:80> ServerName sub1.mydomain.me ProxyPreserveHost On ProxyPass / http://192.168.0.45/ ProxyPassReverse / http://192.168.0.45/ </VirtualHost>
第二台服务器(raspberrypi):
<VirtualHost *:80> ServerName rpi.mydomain.me ServerAdmin webmaster@localhost DocumentRoot /var/www/html/ <Directory /var/www/html> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny Allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn SetEnvIf Request_URI "/cam_pic.php$|/status_mjpeg.php$" dontlog CustomLog ${APACHE_LOG_DIR}/access.log common env=!dontlog </VirtualHost>
apache2ctl -S:在主服务器上
AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/sites-enabled/000-default.conf:1 VirtualHost configuration: *:443 mydomain.me (/etc/apache2/sites-enabled/000-default-le-ssl.conf:2) *:80 is a NameVirtualHost default server mydomain.me (/etc/apache2/sites-enabled/000-default.conf:3) port 80 namevhost mydomain.me (/etc/apache2/sites-enabled/000-default.conf:3) port 80 namevhost rpi.mydomain.me (/etc/apache2/sites-enabled/000-default.conf:36) ServerRoot: "/etc/apache2" Main DocumentRoot: "/var/www/html" Main ErrorLog: "/var/log/apache2/error.log" Mutex watchdog-callback: using_defaults Mutex rewrite-map: using_defaults Mutex ssl-stapling-refresh: using_defaults Mutex ssl-stapling: using_defaults Mutex proxy: using_defaults Mutex ssl-cache: using_defaults Mutex default: dir="/var/lock/apache2" mechanism=fcntl Mutex mpm-accept: using_defaults PidFile: "/var/run/apache2/apache2.pid" Define: DUMP_VHOSTS Define: DUMP_RUN_CFG User: name="www-data" id=33 Group: name="www-data" id=33
我正在使用亚马逊的Route 53作为DNS服务器,并将rpi作为CNAME指向我的外部IP。 任何指针或更多的东西,我可以读会帮助很多。