[英]nginx settings location mis-downloading
我正在Ubuntu 12.04LTS上使用php5-fpm為wordpress和phpMyAdmin設置nginx。
我的phpMyAdmin位於/var/www/phpMyAdmin
,wordpress位於/home/user/workspace/wordpress
,MySQL位於/var/run/mysqld/mysqld.sock
我想將/
映射到wordpress,將/phpmyadmin
映射到phpMyAdmin,那么如何實現呢?
WordPress似乎還可以,但是訪問/phpmyadmin
,瀏覽器將請求“下載”為文件...?
這是我當前的nginx.conf:
server {
listen 8000;
root /home/user/workspace/wordpress;
index index.html index.htm index.php;\
location ~* /phpmyadmin { #TODO: shall here be a tailing slash??
#TODO: root or alias???
}
location ~ \..*/.*\.php$ {
return 403;
}
location / {
#TODO: show the following line be un-commented??
#try_files $uri $uri/ /index.php?q=$uri&$args;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;#TODO: could this being removed??
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
#FIXME: and how to block all access to /home/user/workspace/wordpress/server.d/*
#This doesn't work??
location /sever\.d {
autoindex on;
deny all;
}
而且,如果所有服務器都以www-data:www-data
身份運行,我應該為wordpress/
和phpMyAdmin/
目錄設置什么權限? 目前,我將它們設置為755 user:www-data
,對嗎?
我尚未在Linux下設置服務器,我正在WinXP下使用這些服務器,所以我正在嘗試。
在您之間的位置之間添加此
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
location /phpMyAdmin {
rewrite ^/* /phpmyadmin last;
}
您之間缺少服務器名稱之間的任何位置。 輸入server_name example.com;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.