AMH 6.0 免费版 LNMP 下 Nginx 反代

1,408 views次阅读
3 条评论

前言

对于一个AMH 铁粉,用了N年依然在用!

PS. 更新AMH6.1后,我放弃了多年的AMH。最终归宿也不是宝塔,太臃肿也不适合我。

AMH 6.0 免费版 LNMP 下 Nginx 反代

对于我这样的懒人只要能用就不会换,但今天打开管理后台才发现竟然AMH6.0 都出免费版本了,真是后知后觉啊!~

 

没啥好说的 直接上 PVE 测试一下~感觉还不错。还是哪个味道,内存占用也不多,不错不错!

AMH 6.0 免费版 LNMP 下 Nginx 反代

细细品品发现没了 AMProxy ,没了反代感觉不完整啊!~ 毕竟 是刚需。

 

食用方式

修改虚拟主机配置文件,路径例如:/home/wwwroot/lnmp01/vhost/ 目录下。

AMH 6.0 免费版 LNMP 下 Nginx 反代

找到合适的位置,插入反代脚本即可。

配方一

来自 嗷嗷@loc《Nginx反代的缓存配置》:

104.19.19.19 是 CloudFlare的IP 只是举例。

动态请求不处理

location ~* \.(php|jsp|cgi|asp|aspx)$
{
    proxy_pass https://104.19.19.19;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    proxy_ssl_name $host;
    proxy_ssl_server_name on;
}

全局不缓存

location /
{
    proxy_pass https://104.19.19.19;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    proxy_ssl_name $host;
    proxy_ssl_server_name on;
   
    add_header X-Cache $upstream_cache_status;
        #Set Nginx Cache
        proxy_ignore_headers Set-Cookie Cache-Control expires;
        add_header Cache-Control no-cache;
    expires 12h;
}

静态资源缓存2天

location ~* \.(htm|html|gif|jpg|jpeg|png|bmp|swf|ioc|ico|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma|css|js)$
{
    proxy_pass https://104.19.19.19;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    proxy_ssl_name $host;
    proxy_ssl_server_name on;
   
    add_header X-Cache $upstream_cache_status;
        #Set Nginx Cache

    proxy_ignore_headers Set-Cookie Cache-Control expires;
    proxy_cache cache_one;
    proxy_cache_key $host$uri$is_args$args;
    proxy_cache_valid 200 304 301 302 2d;
    expires 12h;
}

配方二

来自 宝塔(不缓存):

location  ~* \.(php|jsp|cgi|asp|aspx)$
{
    proxy_pass http://bin.entware.net;
    proxy_set_header Host bin.entware.net;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
}
location /
{
    proxy_pass http://bin.entware.net;
    proxy_set_header Host bin.entware.net;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    
    add_header X-Cache $upstream_cache_status;
    
    #Set Nginx Cache
    
    	add_header Cache-Control no-cache;
    expires 12h;
}

 

 

挖坑

Nginx 默认是不安装ngx_http_sub_module模块的,

直接应用sub_filter指令将报错。

因此需要在编译过程中添加 --with-http_sub_module 参数 sub模块替换文本。

https://github.com/yaoweibin/ngx_http_substitutions_filter_module

正文完
 0
HopoL
版权声明:本站原创文章,由 HopoL 于2021-05-03发表,共计2301字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(3 条评论)
hopol 博主
2021-05-05 06:31:24 回复

在这 宝塔一统天下 的大环境下,还有没有用 AMH 的 人呢?

 Windows  Chrome
胖帅 评论达人 LV.1
2021-09-10 00:09:23 回复

所以现在换啥了呢

 Windows  Firefox  中国湖北省武汉市联通
    hopol 博主
    2021-09-10 07:49:02 回复

    @胖帅 OneinStack 和 OpenLiteSpeed [f=shengli]

     Windows  Chrome

HopoL's Blog

文章搜索
最新评论
HopoL HopoL Yeah, back in the older Unraid versions, some folks managed to get it booting from drives like SATA or NVMe by compiling the software themselves. But that method never got updated or maintained afterward, so it might not work with the current setups. Hope that helps!
MickeyDee MickeyDee Slightly off topic but anyone managed to get Unraid to boot off anything other than USB, like sata or nvme? If wrong place please delete and advise
Mrg Mrg I cannot Thank you enough. Thank you , Thank you , Thank you.
阿龙 阿龙 谢谢大佬分享
MickeyDee MickeyDee Cancell that, figured it out and it works, Much appriciated .
MickeyDee MickeyDee Hi Thanks for sharing, please clarify, do you mean Rename the folder "unraider-7.2.0" to unraider and copy it to the config . Thanks
lzdwudi lzdwudi 我也想试试 但我目前的版本是6.12.13 我不敢做大的动作
wice222 wice222 archive is demaged
tstUser01 tstUser01 Thanks for sharing!
saisu saisu how to install from scratch for noobs like me please :D What is GUID ??