部分示例配置

部分示例配置(Some Example Configs)

目录

请注意,这些只是示例配置。你可能需要根据自身需求调整这些配置。所有示例都针对 Wavelog _不_安装在子文件夹中的情况。

提示

这里默认只启用 HTTP(80 端口)的配置。我们强烈建议你为 Web 服务器配置 HTTPS(443 端口)和有效证书。除了加密通信(安全性高得多!)之外,另一个好处是:能记住登录状态 30 天的「保持登录」功能,只有在通过 HTTPS 使用 Wavelog 时才可用。有关 Wavelog 中 HTTPS 的更多信息,请查看此页面 “HTTPS 支持”

Apache2

依赖

确保启用 rewrite 模块

a2enmod rewrite

复制 htaccess 文件

cp /var/www/html/htaccess.sample /var/www/html/.htaccess

配置

<VirtualHost *:80>

        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        <Directory /var/www/html>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Require all granted
        </Directory>

</VirtualHost>

使用 Apache2 从 URL 中移除 index.php(美化 URL)

只需将 application/config/config.php 中的 $config['index_page'] 设为 ''

警告

在 Wavelog 成功安装之前,不要编辑任何文件。最终可编辑的文件 aplication/config/config.php 是在安装过程中生成的。

$config['index_page'] = '';

然后重启 Apache2

systemctl restart apache2

Nginx

配置

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    # TLS
    # this configuration works if the key is not encrypted, if it is encrypted, you need an additional keyfile
    # listen [::]:443 ssl ipv6only=on default;
    # listen *:443 default ssl;
    # ssl_certificate_key /path/to/key.pem;
    # ssl_certificate /path/to/fullchain.pem;
    # ssl_protocols TLSv1.2 TLSv1.3;
    # generate that file with openssl dhparam -out xxx.pem 4096
    # ssl_dhparam /path/to/dhparam.pem;

    # enable H2 - makes connections faster, also allows server push; needs TLS to work
    http2 on;

    # it assumes that Wavelog is installed in /var/www/html. Change accordingly
    root /var/www/html;

    index index.php index.html;

    server_name wavelog.example.com _;
    server_tokens off;

    # index.php fallback
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    # tiles endpoint fallback
    location ^~ /tiles/ {
        try_files $uri $uri/ /index.php?$query_string;
    }

    # deny access to hidden files
    location ~ /\. {
        deny all;
        return 403;
    }

    # deny access to application/
    location ~ /application {
        deny all;
        return 403;
    }

    # favicon.ico
    location = /favicon.ico {
        log_not_found off;
    }

    # robots.txt
    location = /robots.txt {
        log_not_found off;
    }

    # assets
    location ~* \.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ {
        expires 7d;
    }

    # svg, fonts
    location ~* \.(?:svgz?|ttf|ttc|otf|eot|woff2?)$ {
        add_header Access-Control-Allow-Origin "*";
        expires 7d;
    }

    ## gzip (optional)
    # gzip            on;
    # gzip_vary       on;
    # gzip_proxied    any;
    # gzip_comp_level 6;
    # gzip_types      text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;

    # handle .php
    location ~ \.php(/|$) {
        # on arch linux, the default path is /run/php-fpm/php-fpm.sock
        fastcgi_pass unix:/var/run/php/php-fpm.sock;

        # 404
        try_files $fastcgi_script_name =404;

        # default fastcgi_params
        include fastcgi_params;

        # fastcgi settings
        fastcgi_index index.php;
        fastcgi_buffers 8 16k;
        fastcgi_buffer_size 32k;

        # fastcgi params
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }
}

使用 Nginx 从 URL 中移除 index.php(美化 URL)

只需将 application/config/config.php 中的 $config['index_page'] 设为 ''

$config['index_page'] = '';

你可能需要重启 Web 服务器和 php-fpm。如果你使用的不是 8.2 版本,请相应更改 php 版本号。

systemctl restart nginx php8.2-fpm
# on manjaro / arch linux
systemctl restart nginx php-fpm
Wavelog 手册(中文版) / 部分示例配置 0 字 0 行 bg8lng
2026-10-21T12:42:35.995687801Z 2026-10-21T12:43:38.588199387Z