I set up MediaWiki in my /var/www/html
under the folder w/
and I'm trying to recreate the functionality of another wiki that uses root FQDN/
but I am having no success in trying to replicate the behavior with nginx configs
my current nginx is config:
server {
listen 80;
listen [::]:80 ipv6only=on;
server_name domain.wiki www.domain.wiki;
location / {
return 301 https://$host$request_uri;
}
}
server {
listen [::]:443 ssl http2 ipv6only=on;
listen 443 ssl http2;
# SSL ommited
# Headers omitted
root /var/www/html/w;
index index.php;
client_max_body_size 5m;
client_body_timeout 60;
location = /robots.txt { }
location ~ /.(svn|git)(/|$) { deny all; }
location ~ /.ht { deny all; }
location / {
try_files $uri $uri/ @rewrite;
}
location @rewrite {
rewrite ^/(.*)$ /index.php?title=$1&$args;
}
location ^~ /maintenance/ {
return 403;
}
location /rest.php {
try_files $uri $uri/ /rest.php?$args;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
try_files $uri /index.php;
expires max;
log_not_found off;
}
location = /_.gif {
expires max;
empty_gif;
}
location ^~ ^/(cache|includes|maintenance|languages|serialized|tests|images/deleted|archive|mw-config)/ {
deny all;
}
location ^~ ^/(bin|docs|extensions|includes|maintenance|mw-config|resources|serialized|tests)/ {
internal;
}
# Security for 'image' directory
location ~* ^/images/.*.(html|htm|shtml|php)$ {
types { }
default_type text/plain;
}
# Security for 'image' directory
location ^~ /images/ {
try_files $uri /index.php;
}
location ~ /LocalSettings.php { deny all; }
}
and my current LocalSettings.php settings are:
$wgScriptPath = "";
$wgArticlePath = "/$1";
$wgUsePathInfo = true;
## The protocol and server name to use in fully-qualified URLs
$wgServer = "https://mydomain.wiki";
## The URL path to static resources (images, scripts, etc.)
$wgResourceBasePath = $wgScriptPath;
Everything is functional however the first problem is when visiting mydomain.wiki
it does a 301 redirect to mydomain.wiki/Main_Page
where intended behavior is no 301 redirect and the page being mydomain.wiki/
in the url bar omitting that it's Main_Page.
Another thing I was curious about is when I go to edit the source of an article the url is mydomain.wiki/index.php?title=Article&action=edit
the behavior I see on another wiki is otherdomain.wiki/Article?action=edit
omitting the index.php and using pretty url scheme for the Article to be edited.
The first looks like a nginx config problem that I've tried multiple of and ending on mostly nginx's own example, the pretty url ?action=edit
part I'm not sure if it's nginx or internal changes to MediaWiki that the other wiki did.
Any help would be appreciated especially getting rid of the 301 redirect on entering just the FQDN