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/dist
ServerName www.dist.com
<Directory /var/www/dist>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.html [L]
SetOutputFilter DEFLATE
Options FollowSymLinks
AllowOverride All
Require all granted
DirectoryIndex index.php index.html index.htm default.php default.html default.htm
</Directory>
ProxyRequests off
ProxyPass /prod-api http://192.168.0.44:8097
ProxyPassReverse /prod-api http://192.168.0.44:8097
</VirtualHost>
3、隐藏httpd的版本号和操作系统信息。
在/etc/httpd/conf.d/目录中,创建一个servertokens.conf的文件,放入以下内容文章来源:https://www.toymoban.com/news/detail-787174.html
#
# 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
小尾巴~~
只要有积累,就会有进步文章来源地址https://www.toymoban.com/news/detail-787174.html
到了这里,关于linux-前端项目由nginx迁移到apache httpd的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!