ReverseProxy不适用于OSX El Capitan

我试图通过一个更干净的URL访问我的Plex Web UI。 目前,您可以访问http://marvin.boldlygoingnowhere.org:32400/web/index.html 。 我希望它在http://marvin.boldlygoingnowhere.org/plex

inheritance人我有什么,

马文:〜马文$ httpd -v服务器版本:

Apache/2.4.16 (Unix) Server built: Aug 22 2015 16:51:57 Server's Module Magic Number: 20120211:47 Server loaded: APR 1.4.8, APR-UTIL 1.5.2 Compiled using: APR 1.4.8, APR-UTIL 1.5.2 Architecture: 64-bit Server MPM: prefork threaded: no forked: yes (variable process count) Server compiled with.... -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_FLOCK_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=256 -D HTTPD_ROOT="/usr" -D SUEXEC_BIN="/usr/bin/suexec" -D DEFAULT_PIDLOG="/private/var/run/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="/private/etc/apache2/mime.types" -D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf" 

/private/etc/apache2/extra/httpd-vhosts.conf

 Listen 80 # Listen for virtual host requests on all IP addresses <VirtualHost *:80> ServerName marvin.boldlygoingnowhere.org ErrorLog "/private/var/log/apache2/marvin-error_log" CustomLog "/private/var/log/apache2/marvin-access_log" common ServerAdmin [email protected] ProxyRequests Off <Proxy http://marvin.boldlygoingnowhere.org/plex> Order deny,allow Allow from all ProxyPreserveHost off ProxyPass http://localhost:32400 ProxyPassReverse http://localhost:32400 </Proxy> </VirtualHost> 

/private/etc/apache2/httpd.conf

取消注释

Include /private/etc/apache2/extra/httpd-vhosts.conf

LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so

我对这个当前设置的期望是能够达到http://marvin.boldlygoingnowhere.org/plex/web ,而不是我得到一个404。

我是一名手机软件工程师,但这是我的第一次networking冒险之一,它打败了我很难。

有几件事你需要看看这里:

  1. 确保你使用的是正确的configuration文件。 当我在我的El Capitan机器上安装apache 2.4时,主configuration实际上指向一个不同的目录/usr/local/etc/apache2/2.4/httpd.conf

     $ httpd -V Server version: Apache/2.4.17 (Unix) Server built: Nov 13 2015 19:31:42 Server's Module Magic Number: 20120211:51 Server loaded: APR 1.5.2, APR-UTIL 1.5.4 Compiled using: APR 1.5.2, APR-UTIL 1.5.4 Architecture: 64-bit Server MPM: prefork threaded: no forked: yes (variable process count) Server compiled with.... -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=256 -D HTTPD_ROOT="/usr/local/Cellar/httpd24/2.4.17" -D SUEXEC_BIN="/usr/local/Cellar/httpd24/2.4.17/bin/suexec" -D DEFAULT_PIDLOG="/usr/local/var/run/apache2/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="/usr/local/etc/apache2/2.4/mime.types" -D SERVER_CONFIG_FILE="/usr/local/etc/apache2/2.4/httpd.conf" 
  2. 对于反向代理,你可以简单地使用这样的东西:

     <VirtualHost *:80> ServerName marvin.boldlygoingnowhere.org DocumentRoot /var/www/html ProxyPreserveHost On ProxyPass /plex http://127.0.0.1:32400 ProxyPassReverse /plex http://127.0.0.1:32400 </VirtualHost> 

因此,您实际上是在尝试使用自定义URL访问Plex Media Server 。 正如你所看到的,它不只是一个网站,而是一个媒体服务器。 无论如何,这里是一个简化的configuration应该从这里工作的片段:

 <VirtualHost *:80> ServerName marvin.boldlygoingnowhere.org <Proxy *> Order deny,allow Allow from all </Proxy> ProxyRequests Off ProxyPreserveHost On ProxyPass / http://127.0.0.1:32400/ ProxyPassReverse / http://127.0.0.1:32400/ RewriteEngine on RewriteCond %{REQUEST_URI} !^/web RewriteCond %{HTTP:X-Plex-Device} ^$ RewriteRule ^/$ /web/$1 [R,L] 

请确保安装了所有必要的apache模块,并检查您的apache错误日志以排除故障。

似乎Plex提供了更好的解决scheme。 所有你需要做的就是在这里注册: https : //plex.tv/users/sign_in 。 你可以在你的域名注册人configurationmarvin.boldlygoingnowhere.org到https://app.plex.tv/web/app

更新 :从进一步的调查看来,你的虚拟主机条目被Apache忽略。 此外,当您尝试访问http://marvin.boldlygoingnowhere.org&#x65F6; ,它会login到apache文档根目录。 你可以做的是尝试使用像plex.yourdomain.com这样的替代服务器名称,或者在用户目录中设置你的虚拟主机,看看会发生什么。 这篇文章的开始部分可以帮助你: http : //coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/