Nginx phpMyAdmin 反代设置
我本机的开发环境是 Win7 + VMware CentOS
程序和数据库全部存在 Win7 主机外接的移动硬盘,然后在 VMware 里 mount 以共享主机上的内容
这样带着移动硬盘,不管是在哪台电脑,都方便开发
程序内容,存储在 Win7 主机的 d:/vmware_share/www ,Nginx 运行在虚拟机
虚拟机里路径为 /mnt/hgfs/www
MySQL 数据库内容,存储在 Win7 主机的 d:/vmware_share/mysql_data ,服务运行在虚拟机
虚拟机里路径为 /mnt/hgfs/mysql_data
Win7 上用 NaviCat 连接管理 MySQL,有时候也需要用 phpMyAdmin
问题来了,phpMyAdmin 放在 d:/vmware_share/www 的话,vmware 里看到的是 777 权限,也无法更改
phpMyAdmin 777 下不能运行
解决办法:
先试了 alias 不好使,想到用反代,好用。
直接给配置文件
server {
listen 80 default_server;
server_name localhost;
root /mnt/hgfs/www;
include server.conf;
location / {
try_files $uri $uri/ /index.php;
}
location ^~ /phpmyadmin/ {
proxy_pass http://localhost:7788;
}
index index.html index.php;
autoindex on;
}
server {
listen 7788;
server_name localhost;
root /home/www/default;
include server.conf;
location / {
try_files $uri $uri/ /index.php;
}
index index.html index.php;
autoindex on;
}
listen 80 default_server;
server_name localhost;
root /mnt/hgfs/www;
include server.conf;
location / {
try_files $uri $uri/ /index.php;
}
location ^~ /phpmyadmin/ {
proxy_pass http://localhost:7788;
}
index index.html index.php;
autoindex on;
}
server {
listen 7788;
server_name localhost;
root /home/www/default;
include server.conf;
location / {
try_files $uri $uri/ /index.php;
}
index index.html index.php;
autoindex on;
}
Incoming search terms:
- debian 7 nginx phpmyadmin
- 反代设置
- location phpmyadmin {
- nginx alias phpmyadmin
- nginx|AndysBlog
- nginx 反代系列教程
- nginx反代 插件
- nginx防止反代
- phpmyadmin nginx
- try_files
- proxy_pass phpmyadmin
Tags: alias, nginx, phpmyadmin, proxy_pass
andy 兄,你的 seo searchterms tagging 2 能分享下吗?官方的版本没法兼容中文关键词。