linux-前端项目由nginx迁移到apache httpd

6 篇文章 0 订阅
2 篇文章 0 订阅

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的文件,放入以下内容

#
# 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

小尾巴~~
只要有积累,就会有进步

  • 8
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值