51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

Nginx设置alias别名目录访问

修改nginx配置文件

cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak  #备份配置文件

vi /usr/local/nginx/conf/nginx.conf  #修改配置文件
server {
  listen       80;
  server_name  localhost;

  #charset utf-8;

  #access_log  logs/host.access.log  main;

  location / {
    root   html;
    index index.php  index.html index.htm;
  }

下面添加以下内容:

location /phpmyadmin {
  alias /home/phpmyadmin;
  index index.php;
}

location ~ /phpmyadmin/.+.php$ {
  if ($fastcgi_script_name ~ /phpmyadmin/(.+.php.*)$) {
    set $valid_fastcgi_script_name $1;
  }
  include fastcgi_params;
  fastcgi_pass   127.0.0.1:9000;
  fastcgi_index  index.php;
  fastcgi_param SCRIPT_FILENAME /home/phpmyadmin/$valid_fastcgi_script_name;
}

标签: nginx,phpmyadmin,alias

赞(2)
未经允许不得转载:工具盒子 » Nginx设置alias别名目录访问