linux-前端项目由nginx迁移到apache httpd
1、前端项目存放目录为 /var/www/dist
虚拟主机端口80
反向代理拦截 /prod-api
后端服务地址 http://192.168.0.44:8097
2、在/etc/httpd/conf.d/目录中,创建一个vhost.conf的文件,放入以下内容
<VirtualHost *:80>DocumentRoot /var/www/distServerName www.dist.com<Directory /var/www/dist>RewriteEngine onRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . index.html [L]SetOutputFilter DEFLATEOptions FollowSymLinksAllowOverride AllRequire all grantedDirectoryIndex index.php index.html index.htm default.php default.html default.htm</Directory>ProxyRequests offProxyPass /prod-api http://192.168.0.44:8097ProxyPassReverse /prod-api http://192.168.0.44:8097
</VirtualHost>
3、隐藏httpd的版本号和操作系统信息。
在/etc/httpd/conf.d/目录中,创建一个servertokens.conf的文件,放入以下内容
#
# ServerTokens
# This directive configures what you return as the Server HTTP response
# Header. The default is 'Full' which sends information about the OS-Type
# and compiled in modules.
# Set to one of: Full | OS | Minor | Minimal | Major | Prod
# where Full conveys the most information, and Prod the least.
#
ServerTokens Prod
小尾巴~~
只要有积累,就会有进步