[英]nginx settings location mis-downloading
I'm setting up nginx with php5-fpm on Ubuntu 12.04LTS for wordpress and phpMyAdmin. 我正在Ubuntu 12.04LTS上使用php5-fpm为wordpress和phpMyAdmin设置nginx。
My phpMyAdmin locates in /var/www/phpMyAdmin
, wordpress in /home/user/workspace/wordpress
, MySQL at /var/run/mysqld/mysqld.sock
我的phpMyAdmin位于
/var/www/phpMyAdmin
,wordpress位于/home/user/workspace/wordpress
,MySQL位于/var/run/mysqld/mysqld.sock
I want to map /
to wordpress, /phpmyadmin
to phpMyAdmin, so how can I achieve this?? 我想将
/
映射到wordpress,将/phpmyadmin
映射到phpMyAdmin,那么如何实现呢?
Wordpress seemed OK, but when accessing /phpmyadmin
, the browser "downloads" the request as files...?? WordPress似乎还可以,但是访问
/phpmyadmin
,浏览器将请求“下载”为文件...?
This is my current nginx.conf: 这是我当前的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;
}
And, what permission should I set for both the directory wordpress/
and phpMyAdmin/
if all the servers are running as www-data:www-data
?? 而且,如果所有服务器都以
www-data:www-data
身份运行,我应该为wordpress/
和phpMyAdmin/
目录设置什么权限? Currently I set them as 755 user:www-data
, is that correct?? 目前,我将它们设置为
755 user:www-data
,对吗?
I haven't set up server under linux yet, I was using those servers under WinXP, so I'm trying. 我尚未在Linux下设置服务器,我正在WinXP下使用这些服务器,所以我正在尝试。
in you between location add this 在您之间的位置之间添加此
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;
}
anywhere between also your missing a server name. 您之间缺少服务器名称之间的任何位置。 type in a server_name example.com;
输入server_name example.com;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.