Hello everyone!
I'm migrating everything from an old server to a new one and moving from apache2 to nginx, and from mysql to mariaDB, and from one domain to another (just asking for trouble, I know). I'm using Ubuntu Server 24.04.1.
There are two main problems that I've noticed:
1) When you first open the site it takes about a whole minute or even two for it to open. If you are clicking through it (not idle on something else) it loads the next page really slowly.
2) My logo and favicon images are broken. I deleted and reuploaded them, but they are still broken. The favicon comes and goes, sometimes being present, sometimes gone. Also in the login page the background image is the one I uploaded, but there was another image above the username part that is now broken. I'm using the standard boost theme.
I passed the database over by running mysqldump, and importing on mariaDB on my new server. I downloaded and installed Moodle, then copied the old moodledata folder over the new one. I adapted the config.php to the new settings. I'm using Moodle 4.5.1+, latest build. I also used the Search and replace tool and noticed no difference.
Thanks in advance!
Here is my nginx config for Moodle (I made it anonymous):
server {
server_name example.com www.example.com;
root /var/www/html/moodle;
index index.php index.html index.htm;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
# 1) Basic location
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# 2) Slash-argument-compatible location for PHP
# (Captures both index.php and index.php/anything)
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
}
# 4) Static file caching
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
try_files $uri /index.php?$query_string;
}
location /dataroot/ {
internal;
alias /var/moodledata/;
}
# 5) SSL config
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name example.com www.example.com;
return 404; # managed by Certbot
}
And, in case it helps, my nginx.conf
user www-data;
worker_processes auto;
pid /run/nginx.pid;
error_log /var/log/nginx/error.log;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
##
# Gzip Settings
##
gzip on;
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml ap>
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}