nginx配置文件不生效,什么问题?

发布于 2021-11-18 13:21:23 字数 2130 浏览 770 评论 2

只是关于dokuwiki的那一段server{}没生效,

先描述下,我是在windows上测试,web根目录是G:/Server/data/html/

dokuwiki安装在G:/Server/data/html/wiki/

nginx.conf内容:

worker_processes  1;

events {
    worker_connections  1024;
}


http {
	include       mime.types;
	default_type  application/octet-stream;
	sendfile        on;
	client_max_body_size  8m;
	fastcgi_buffer_size  128k;
	fastcgi_buffers  8 128k;
	send_timeout  300;
	fastcgi_connect_timeout  300;
	fastcgi_send_timeout  300;
	fastcgi_read_timeout  300;
	fastcgi_busy_buffers_size  256k;
	fastcgi_temp_file_write_size  256k;
	fastcgi_intercept_errors  on;
	keepalive_timeout  65;

	server_name_in_redirect off;
	server_names_hash_bucket_size 128;

server {
	listen       80;
	server_name  localhost;

location / {
	root   /Server/data/html;
	index  index.html index.htm index.php;
	autoindex on;
	if (!-e $request_filename) {
	rewrite (.*) /?index.php/$1;
	}
	}

location ~ .php$ {
	root           /Server/data/html;
	fastcgi_pass   127.0.0.1:9000;
	fastcgi_index  index.php;
	fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
	include        fastcgi_params;
	}

location ~ /.ht {
	deny  all;
	}
}

#dokuwiki配置开始
server {
        server_name localhost;
        root /Server/data/html;

	location /wiki/(data|conf|bin|inc)/ {
		deny all;
	}

        location /wiki/ {
                index doku.php;
                try_files $uri $uri/ @dokuwiki;
        }

        location @dokuwiki {
                rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
                rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
                rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
                rewrite ^/(.*) /doku.php?id=$1 last;
        }

	location ~ .php$ {
		include fastcgi_params;
		fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
		fastcgi_pass 127.0.0.1:9000;
	}
}
#dokuwiki配置结束
}

 

就是注释中的那段没生效...小弟菜鸟还找不到原因在哪儿,请大伙儿指点下

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

清晨说ぺ晚安 2021-11-22 07:42:40

手工指定一下document_root试一下。   

静谧 2021-11-19 21:30:45

Nginx的Dokuwiki配置有官方版本的。你可以去看看

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文