如何配置apache与FE一起工作并在同一台机器上?

如何配置apache与FE一起工作并在同一台机器上?,apache,configuration,server,Apache,Configuration,Server,我需要配置一个apache服务器,为同一台机器上的前端和后端php提供服务。 应考虑以下事项: 后端是RESTful的,API由防火墙保护,在实现API令牌之前,仅允许本地主机访问作为临时解决方案。 目前,前端与后端位于同一台计算机上,但将在一段时间内移动到另一台服务器。 静态内容将从后端计算机交付 我当前的配置如下所示: NameVirtualHost *:80 NameVirtualHost *:81 ServerName www.myServer.de

我需要配置一个apache服务器,为同一台机器上的前端和后端php提供服务。 应考虑以下事项:

后端是RESTful的,API由防火墙保护,在实现API令牌之前,仅允许本地主机访问作为临时解决方案。 目前,前端与后端位于同一台计算机上,但将在一段时间内移动到另一台服务器。 静态内容将从后端计算机交付 我当前的配置如下所示:

NameVirtualHost *:80 NameVirtualHost *:81 ServerName www.myServer.de ServerAdmin webmaster@localhost DocumentRoot /data/fe/public Options FollowSymLinks AllowOverride None Order Deny,Allow Deny from All Options FollowSymLinks AllowOverride AuthConfig Order allow,deny allow from all RewriteEngine On # Redirect Trailing Slashes... RewriteRule ^(.*)/$ /$1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all ErrorLog ${APACHE_LOG_DIR}/error_fe.log CustomLog ${APACHE_LOG_DIR}/access_fe.log combined ServerAdmin webmaster@localhost DocumentRoot /data/be/public Options FollowSymLinks AllowOverride None Order Deny,Allow Deny from All Options FollowSymLinks AllowOverride AuthConfig Order allow,deny allow from all RewriteEngine On # Redirect Trailing Slashes... RewriteRule ^(.*)/$ /$1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] ErrorLog ${APACHE_LOG_DIR}/error_be.log CustomLog ${APACHE_LOG_DIR}/access_be.log combined 我如何配置后端以提供静态内容而不受访问限制,同时保持API的安全性。还是通过应用程序交付静态内容

我正在使用

Debian 8.1 Apache2.4
最后,我配置了一个反向代理来交付静态内容。我在前端vhost中添加了以下行:

ProxyPreserveHost On

ProxyPass /images http://<BE-IP>:81/files/images
ProxyPassReverse /images http://<BE-IP>:81/files/images

通过这种配置,后端仍然受到防火墙的保护,不受外部请求的影响,但允许FE请求图像。

我投票关闭这个问题,因为它不是一个编程问题。在unix.stackexchange.com或超级用户上可能会更好