标签 apache 下的文章

inbucket - apache - 反向代理 websocket 设置 - RequestHeader unset Origin

问题:如果想通过域名来访问 inbucket 的页面,在 apache 里设置反向代理后,inbucket 的 monitor 页显示 disconnected 。

尝试:Monitor 页的信息是调用 WebSocket 信息显示的,需要在 apache 的反向代理设置内容中,有相应的内容,如:

RequestHeader unset Origin  

RewriteEngine On
RewriteCond %{HTTP:Connection} Upgrade [NC]
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteRule /(.*) ws://127.0.0.1:9000/$1 [P,L]

ProxyRequests Off
SSLProxyEngine on
ProxyPass / http://127.0.0.1:9000/
ProxyPassReverse / http://127.0.0.1:9000/

参考:

在 apache 里设置 acme 验证证书的目录

如这里提到的:https://doc.owncloud.com/server/next/admin_manual/installation/letsencrypt/apache.html

我拿来套用的例子:

<VirtualHost *:443>
    ServerName demo.anqun.org

  Alias /.well-known/acme-challenge/ /var/www/acme/.well-known/acme-challenge/
  <Directory "/var/www/acme/.well-known/acme-challenge/">
      Options None
      AllowOverride None
      ForceType text/plain
      RedirectMatch 404 "^(?!/\.well-known/acme-challenge/[\w-]{43}$)"
  </Directory>

 SSLEngine on
 SSLCertificateFile  /root/.acme.sh/demo.anqun.org_ecc/demo.anqun.org.cer
 SSLCertificateKeyFile /root/.acme.sh/demo.anqun.org_ecc/demo.anqun.org.key
 SSLCertificateChainFile  /root/.acme.sh/demo.anqun.org_ecc/ca.cer

</VirtualHost>

<VirtualHost *:80>
  ServerName demo.anqun.org
  Redirect permanent / https://demo.anqun.org/
  Alias /.well-known/acme-challenge/ /var/www/acme/.well-known/acme-challenge/
  <Directory "/var/www/acme/.well-known/acme-challenge/">
      Options None
      AllowOverride None
      ForceType text/plain
      RedirectMatch 404 "^(?!/\.well-known/acme-challenge/[\w-]{43}$)"
  </Directory>
</VirtualHost>

pkg install apache24 - 在FreeBSD上安装 apache web

在FreeBSD里安装apache web挺简单的。

  • 安装命令:pkg install apache24
  • 启动apache命令:/usr/local/sbin/httpd -k start
  • 更改配置文件后,重载apache命令:/usr/local/sbin/httpd - graceful
  • 停止apache命令:/usr/local/sbin/httpd -k stop

apache的配置文件默认为:/usr/local/etc/apache24/httpd.conf。如需启用用户主目录下的public_html作为网页访问网址,除了要移除注释/etc/apache24/extral/httpd-userdir.conf外,还需要启用 LoadModule userdir_module libexec/apache24/mod_userdir.so 这一行。

参考:

视频:https://www.bilibili.com/video/BV1M44y1B7dK/

cPanel - WHM - Invalid command 'SetEnv' - <IfVersion

问题:新安装的cPanel/WHM 环境,访问Magento2程序网站返回500错误,日志里有如下的内容:

public_html/.htaccess: Invalid command 'SetEnv', perhaps misspelled or defined by a module not included in the server configuration
public_html/app/.htaccess: Invalid command '<IfVersion', perhaps misspelled or defined by a module not included in the server configuration

尝试:以root账户登录到WHM面板,通过EasyApache4,安装mod_envmod_version的apache组件。

参考: