1
老實說 - 我是使用Nginx的新手,但看起來很簡單。 我只是在我的服務器上安裝了Mediawiki的,應用的數據庫等,而且它是由在 http://wiki.rebirthgaming.org/index.php?title=Main_Page使用Nginx的Mediawiki的短網址
運行我想用短網址,雖然。我使用redwerks工具來構建我的nginx配置並將更改應用到LocalSettings.php。 nginx.conf設置工作 - 網站現在正在運行這些設置。然而,當我添加這些設置的LocalSettings.php,我得到404
,我加這404的是localsettings:
$wgArticlePath = "/$1";
$wgUsePathInfo = true;
$wgScriptExtension = ".php";
$wgGenerateThumbnailOnParse = false;
我的nginx.conf如下:
server {
listen 80;
server_name wiki.rebirthgaming.org;
root /var/www/wiki.rebirthgaming.org;
index index.php;
location/{
try_files $uri $uri/ wiki.rebirthgaming.org;
# Do this inside of a location so it can be negated
location ~ \.php$ {
try_files $uri $uri/ =404; # Don't let php execute non-existent php files
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
}
}
location /images {
# Separate location for images/ so .php execution won't apply
location ~ ^/images/thumb/(archive/)?[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ {
# Thumbnail handler for MediaWiki
# This location only matches on a thumbnail's url
# If the file does not exist we use @thumb to run the thumb.php script
try_files $uri $uri/ @thumb;
}
}
location /images/deleted {
# Deny access to deleted images folder
deny all;
}
# Deny access to folders MediaWiki has a .htaccess deny in
location /cache { deny all; }
location /languages { deny all; }
location /maintenance { deny all; }
location /serialized { deny all; }
# Just in case, hide .svn and .git too
location ~ /.(svn|git)(/|$) { deny all; }
# Hide any .htaccess files
location ~ /.ht { deny all; }
# Uncomment the following code if you wish to hide the installer/updater
## Deny access to the installer
#location /mw-config { deny all; }
# Handling for the article path
location wiki.rebirthgaming.org {
include /etc/nginx/fastcgi_params;
# article path should always be passed to index.php
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_pass 127.0.0.1:9000;
}
# Thumbnail 404 handler, only called by try_files when a thumbnail does not exist
location @thumb {
# Do a rewrite here so that thumb.php gets the correct arguments
rewrite ^/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /thumb.php?f=$1&width=$2;
rewrite ^/images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /thumb.php?f=$1&width=$2&archived=1;
# Run the thumb.php script
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/thumb.php;
fastcgi_pass 127.0.0.1:9000;
}
}
}
我想我的網址看起來像這樣: wiki.rebirthgaming.org/Main_Page
我一直試圖弄清楚這一整天,嘗試不同的設置等,但它alw ays在進行本地設置更改時失敗。