Mac微信插件:如何让你的微信体验提升5倍?
2026/5/5 19:03:41
以下是安装 OpenResty(基于 Nginx 的增强版 Web 平台)的详细步骤,涵盖主流通用系统环境及验证方法:
sudo apt update sudo apt install -y libpcre3-dev libssl-dev perl make build-essential zlib1g-dev# 导入 GPG 密钥 wget -qO - https://openresty.org/package/pubkey.gpg | sudo apt-key add - # 添加 APT 源 echo "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/openresty.list # 更新仓库索引 sudo apt updatesudo apt install -y openresty
openresty -v # 应显示版本号(如 openresty/1.21.4.1)
wget https://openresty.org/download/openresty-1.21.4.1.tar.gz tar -xzvf openresty-1.21.4.1.tar.gz cd openresty-1.21.4.1./configure \ --prefix=/usr/local/openresty \ --with-luajit \ --with-http_ssl_module \ --with-http_v2_module \ --with-http_stub_status_module \ --with-pcre-jitmake -j$(nproc) # 使用多核加速编译 sudo make installecho 'export PATH=/usr/local/openresty/nginx/sbin:$PATH' >> ~/.bashrc source ~/.bashrc| 操作 | 命令 |
|---|---|
| 启动服务 | sudo systemctl start openresty |
| 停止服务 | sudo systemctl stop openresty |
| 重载配置 | sudo systemctl reload openresty |
| 设置开机自启 | sudo systemctl enable openresty |
| 检查配置文件语法 | sudo nginx -t |
编辑/usr/local/openresty/nginx/conf/nginx.conf,添加以下内容:
server { listen 80; server_name localhost; location /hello { default_type text/plain; content_by_lua_block { ngx.say("Hello, OpenResty!") } } }sudo nginx -s reload curl http://localhost/hello # 应输出 "Hello, OpenResty!"sudo chown -R www-data:www-data /usr/local/openresty重新编译时添加所需模块(如--with-http_gzip_static_module)
# 仓库安装 sudo apt remove openresty && sudo apt autoremove # 源码安装 sudo rm -rf /usr/local/openresty通过以上步骤即可完成 OpenResty 的安装与基础配置。建议优先使用官方仓库安装以简化维护流程,需要深度定制时再选择源码编译。
希望以上分享能为您带来启发。如果您正在寻找云服务,无论是初创项目寻求高性价比方案,还是成熟业务需要优化IT成本,都不妨了解一下非凡云。非凡云集自营服务的稳定与代理渠道的实惠于一身,或许正是您一直在寻找的“最优解”。