2013-07-25 3 views
0

Сегодня я начал создавать сервер с NGINX, мне удалось настроить PHP и MySQL, все идет хорошо. Однако мне нужно, чтобы NGINX открывал PhpMyAdmin (до того, как он был в корне каталога [Пример: C: \ Server \ WWW - ROOT/C: \ Server \ - где будет PhpMyAdmin])Как настроить PhpMyAdmin на NGINX (Windows)

Я пробую все (отметив, что использование Windows 7 Ultimate x64) Может ли кто-нибудь мне помочь?

Мой nginx.conf (полное)

#user nobody; 
worker_processes 1; 

#error_log logs/error.log; 
#error_log logs/error.log notice; 
#error_log logs/error.log info; 

#pid  logs/nginx.pid; 


events { 
    worker_connections 1024; 
} 


http { 
    include  mime.types; 
    default_type application/octet-stream; 

    #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 
    #     '$status $body_bytes_sent "$http_referer" ' 
    #     '"$http_user_agent" "$http_x_forwarded_for"'; 

    #access_log logs/access.log main; 

    sendfile  on; 
    #tcp_nopush  on; 

    #keepalive_timeout 0; 
    keepalive_timeout 65; 

    #gzip on; 

    server { 
     listen  80; 
     server_name localhost; 

     #charset koi8-r; 

     #access_log logs/host.access.log main; 

     location/{ 
      root C:\MHServer\www; 
      index index.php index.html index.htm; 
     } 

     #error_page 404    /404.html; 

     # redirect server error pages to the static page /50x.html 
     # 
     error_page 500 502 503 504 /50x.html; 
     location = /50x.html { 
      root C:\MHServer\www; 
     } 

     # proxy the PHP scripts to Apache listening on 127.0.0.1:80 
     # 
     #location ~ \.php$ { 
     # proxy_pass http://127.0.0.1; 
     #} 

     # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 
     # 
     location ~ \.php$ { 
      root   C:\MHServer\www; 
      include fastcgi_params; 
      fastcgi_pass 127.0.0.1:9000; 
      fastcgi_index index.php; 
      fastcgi_param SCRIPT_FILENAME $request_filename; 
      include  fastcgi_params; 
     } 

     # deny access to .htaccess files, if Apache's document root 
     # concurs with nginx's one 
     # 
     #location ~ /\.ht { 
     # deny all; 
     #} 
    } 


    # another virtual host using mix of IP-, name-, and port-based configuration 
    # 
    #server { 
    # listen  8000; 
    # listen  somename:8080; 
    # server_name somename alias another.alias; 

    # location/{ 
    #  root C:\MHServer\www; 
    #  index index.html index.htm; 
    # } 
    #} 


    # HTTPS server 
    # 
    #server { 
    # listen  443; 
    # server_name localhost; 

    # ssl     on; 
    # ssl_certificate  cert.pem; 
    # ssl_certificate_key cert.key; 

    # ssl_session_timeout 5m; 

    # ssl_protocols SSLv2 SSLv3 TLSv1; 
    # ssl_ciphers HIGH:!aNULL:!MD5; 
    # ssl_prefer_server_ciphers on; 

    # location/{ 
    #  root C:\MHServer\www; 
    #  index index.html index.htm; 
    # } 
    #} 

    #PhpMyAdmin 
    server{ 
     server_name localhost/phpmyadmin; 
    # access_log /var/...........................; 
     root C:\MHServer\Phpmyadmin; 
     location /phpmyadmin { 
       index index.php index.html index.htm; 
     } 
    } 

} 
+0

Хммм ... не могли бы вы уточнить ваш комментарий? Между тем, я не видел никакой директивы прослушивания внутри блока сервера для phpMyAdmin. Кроме того, рассмотрите возможность перемещения phpMyAdmin в C: \ MHServer \ www \ Phpmyadmin? –

ответ

0
server { 
    listen  80; 
    server_name localhost; 

    location/{ 
     root C:\MHServer\www; 
     index index.php index.html index.htm; 
    } 

    location =/{ 
     root C:\MHServer\www; 
     index index.php index.html index.htm; 
    } 

    #error_page 404    /404.html; 

    # redirect server error pages to the static page /50x.html 
    # 
    error_page 500 502 503 504 /50x.html; 
    location = /50x.html { 
     root C:\MHServer\www; 
    } 


    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 
    # 
    location ~ \.php$ { 
     root   C:\MHServer\www; 
     include fastcgi_params; 
     fastcgi_pass 127.0.0.1:9000; 
     fastcgi_index index.php; 
     fastcgi_param SCRIPT_FILENAME $request_filename; 
     include  fastcgi_params; 
    } 

    location /Phpmyadmin { 
     root C:\MHServer\; 
     index index.php index.html index.htm; 
     location ~ ^/Phpmyadmin/(.+\.php)$ { 
      try_files $uri = 404; 
      root C:\MHServer\; 
      fastcgi_pass 127.0.0.1:9000; 
      fastcgi_index index.php; 
      fastcgi_param SCRIPT_FILENAME $request_filename; 
      include fastcgi_params; 
     } 
     location ~* ^/Phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { 
      root C:\MHServer\; 
     } 
    } 

    location /phpmyadmin { 
     rewrite ^/* /Phpmyadmin last; 
    } 

} 
+0

Не работает ... Печать: http://prntscr.com/1hddah –

+0

Вы обновили путь до phpmyadmin? или попробуйте изменить имя папки 'location/phpMyAdmin {' to 'location/Phpmyadmin {' – kashimu

+0

, используя этот код для вашего NGINX, не запускается! –

0

Моя новая конфигурация с PhpMyAdmin Однако, когда я получить доступ к PhpMyAdmin не появится "входной файл указан." PS .: Мой PHPMYADMIN находится в ИНК папку внутри папки NGINX

#user nobody; 
worker_processes 1; 

#error_log logs/error.log; 
#error_log logs/error.log notice; 
#error_log logs/error.log info; 

#pid  logs/nginx.pid; 


events { 
    worker_connections 1024; 
} 


http { 
    include  mime.types; 
    default_type application/octet-stream; 

    #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 
    #     '$status $body_bytes_sent "$http_referer" ' 
    #     '"$http_user_agent" "$http_x_forwarded_for"'; 

    #access_log logs/access.log main; 

    sendfile  on; 
    #tcp_nopush  on; 

    #keepalive_timeout 0; 
    keepalive_timeout 65; 

    #gzip on; 

    server { 
     include httport; 
     server_name localhost; 

     #charset koi8-r; 

     #access_log logs/host.access.log main; 

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

     #error_page 404    /404.html; 

     # redirect server error pages to the static page /50x.html 
     # 
     error_page 500 502 503 504 /50x.html; 
     location = /50x.html { 
      root /MHServer/www; 
     } 

     # proxy the PHP scripts to Apache listening on 127.0.0.1:80 
     # 
     #location ~ \.php$ { 
     # proxy_pass http://127.0.0.1; 
     #} 

     # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 
     # 
     location ~ \.php$ { 
      root   /MHServer/www; 
      include fastcgi_params; 
      fastcgi_pass 127.0.0.1:9000; 
      fastcgi_index index.php; 
      fastcgi_param SCRIPT_FILENAME $request_filename; 
      include  fastcgi_params; 
     } 

     location /phpmyadmin { 
      root inc; 
      index index.php; 
     } 
      location ~ ^/phpmyadmin.+\.php$ { 
      root inc; 
      fastcgi_index index.php; 
      fastcgi_pass 127.0.0.1:9000; 
      fastcgi_param SCRIPT_FILENAME $request_filename; 
      include fastcgi_params; 
     } 

      rewrite ^/phpMyAdmin /phpmyadmin last; 
      rewrite ^/pma /phpmyadmin last; 

     # deny access to .htaccess files, if Apache's document root 
     # concurs with nginx's one 
     # 
     #location ~ /\.ht { 
     # deny all; 
     #} 
    } 


    # another virtual host using mix of IP-, name-, and port-based configuration 
    # 
    #server { 
    # listen  8000; 
    # listen  somename:8080; 
    # server_name somename alias another.alias; 

    # location/{ 
    #  root /MHServer/www; 
    #  index index.html index.htm; 
    # } 
    #} 


    # HTTPS server 
    # 
    #server { 
    # listen  443; 
    # server_name localhost; 

    # ssl     on; 
    # ssl_certificate  cert.pem; 
    # ssl_certificate_key cert.key; 

    # ssl_session_timeout 5m; 

    # ssl_protocols SSLv2 SSLv3 TLSv1; 
    # ssl_ciphers HIGH:!aNULL:!MD5; 
    # ssl_prefer_server_ciphers on; 

    # location/{ 
    #  root /MHServer/www; 
    #  index index.html index.htm; 
    # } 
    #} 

} 
Смежные вопросы