我需要配置一个apache服务器来为同一台机器上的前端和后端(两个php)提供服务。 以下是考虑:
我目前的配置如下:
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安全。或者它是否可以通过应用程序提供静态内容?
我正在使用
答案 0 :(得分:0)
我最终配置了一个反向代理来传递静态内容。我在我的前端vhost中添加了以下行:
ProxyPreserveHost On
ProxyPass /images http://<BE-IP>:81/files/images
ProxyPassReverse /images http://<BE-IP>:81/files/images
通过这种配置,后端仍然可以通过防火墙保护外部请求,但允许FE请求图像。