AMH 6.0 免费版 LNMP 下 Nginx 反代

1,411 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

文章搜索
最新评论
Metaldololity Metaldololity Whoa, that's really simple. You just save my time a lot. Thankyou!
HopoL HopoL Since you’ve got the backup, it’s actually pretty simple. Just restore the backup files to your new flash drive, then head over to the /config directory and edit the go file. Look for export UNRAID_GUID=xxxxxxxxxxxxxx and swap it with your new drive's GUID. That should do the trick!
Metaldololity Metaldololity Really apreciate for your fast respond, mate. I actually have the backup of the flashdrive (from regular unraid backup). The problem is, when i search on youtube tutorial about changing the failed flashdrive, the process need some sort of confirmation with an account in unraid (blacklist the old one -> whitelist the new one). Since i have a cracked unraid, i don't know how to register my new flashdrive as the correct one (and the system not asking me for the old failed flashdrive). Thanks in advance
HopoL HopoL Man, that's a tough spot to be in. Regularly backing up your /boot folder is super important for exactly this reason. If you don't have a backup and your flash drive is completely fried, your best bet is to Google some specific recovery guides or check the Unraid forums. There are ways to rebuild your config by identifying your parity and data drives, but it can be a bit of a process. Hope you can get it sorted!
Metaldololity Metaldololity Hi! Huge thanks for the update on 7.2.0. I have question here, my flashdrive corrupted. how do i install it on the new flashdrive without losing all my configuration?
acettu acettu well tnx is possible to update it?
HopoL HopoL Ciao!‌ Per trovare il tuo GUID, ti consiglio di cercare su Google qualcosa come "unRAID GUID tutorial" o "come ottenere il Flash GUID di unRAID". Ci sono tante guide dettagliate che ti spiegano passo passo come fare. Poiché il metodo esatto può variare a seconda del tuo setup, è meglio seguire una guida affidabile piuttosto che provare a spiegartelo qui. Buona fortuna!
HopoL HopoL Hey there! To find your GUID, I'd recommend searching for "unRAID GUID tutorial" or "how to get unRAID Flash GUID" on Google. There are plenty of detailed guides out there that walk you through the process step by step. Since the exact method can vary depending on your setup, it's best to follow a trusted tutorial rather than me trying to explain it here. Good luck!
acettu acettu tnx can you explain where i get my GUID?
HopoL HopoL full