C# 如何在NGINX(Windows)上配置PhpMyAdmin
今天我开始用NGINX制作服务器,我成功地设置了PHP和MySQL,一切都很顺利。 但是,我需要NGINX open PhpMyAdmin(在进入根目录之前[例如:C:\Server\WWW-root/C:\Server \-PhpMyAdmin将在哪里]) 我正在尝试一切(注意使用Windows7 Ultimate x64) 有人能帮我吗 My nginx.conf(完整)C# 如何在NGINX(Windows)上配置PhpMyAdmin,c#,php,windows,nginx,phpmyadmin,C#,Php,Windows,Nginx,Phpmyadmin,今天我开始用NGINX制作服务器,我成功地设置了PHP和MySQL,一切都很顺利。 但是,我需要NGINX open PhpMyAdmin(在进入根目录之前[例如:C:\Server\WWW-root/C:\Server \-PhpMyAdmin将在哪里]) 我正在尝试一切(注意使用Windows7 Ultimate x64) 有人能帮我吗 My nginx.conf(完整) 使用phpMyAdmin的新配置 但是,当我访问phpMyAdmin时,会显示“未指定输入文件” 注:我的phpMyAd
使用phpMyAdmin的新配置 但是,当我访问phpMyAdmin时,会显示“未指定输入文件” 注:我的phpMyAdmin位于文件夹NGINX中的inc文件夹中
#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;
# }
#}
}
#用户无人;
工人1;
#错误日志/error.log;
#错误日志/error.log通知;
#错误日志/error.log信息;
#pid日志/nginx.pid;
事件{
工人(1024);;
}
http{
包括mime.types;
默认_类型应用程序/八位字节流;
#日志格式主“$remote\u addr-$remote\u user[$time\u local]“$request””
#“$status$body\u bytes\u sent”$http\u referer”
#“$http_user_agent”“$http_x_forwarded_for””;
#access_log logs/access.log main;
发送文件到;
#tcp_nopush on;
#保持激活超时0;
保持生命超时65;
#gzip on;
服务器{
听8080;
服务器名称localhost;
#charset-koi8-r;
#access_log logs/host.access.log main;
地点/{
根html;
index.html index.htm;
}
#错误\u第404/404.html页;
#将服务器错误页面重定向到静态页面/50x.html
#
错误\u第500页502 503 504/50x.html;
location=/50x.html{
根html;
}
#将PHP脚本代理到Apache,并在127.0.0.1:80上侦听
#
#位置~\.php${
#代理通行证http://127.0.0.1;
#}
#将PHP脚本传递给FastCGI服务器,并在127.0.0.1:9000上侦听
位置~\.php${
根html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index.php;
fastcgi_参数SCRIPT_FILENAME/scripts$fastcgi_SCRIPT_name;
包括fastcgi_参数;
}
位置/phpmyadmin{
根html;
index.php;
}
位置~^/phpmyadmin.+\.php${
根html;
fastcgi_index.php;
fastcgi_pass 127.0.0.1:9000;
fastcgi_参数脚本_文件名$request_文件名;
包括fastcgi_参数;
}
重写^/phpMyAdmin/phpMyAdmin last;
最后重写^/pma/phpmyadmin;
#拒绝访问.htaccess文件,如果Apache的文档根
#同意nginx的观点
#
#位置~/\.ht{
#否认一切;
#}
}
#另一个虚拟主机混合使用基于IP、名称和端口的配置
#
#服务器{
#听八千;
#听某人的名字:8080;
#服务器名称somename别名另一个别名;
#地点/{
#根html;
#index.html index.htm;
# }
#}
#HTTPS服务器
#
#服务器{
#听443ssl;
#服务器名称localhost;
#ssl_证书cert.pem;
#ssl\u证书\u密钥cert.key;
#ssl_会话_缓存共享:ssl:1m;
#ssl_会话_超时;
#ssl_密码高:!aNULL:!MD5;
#ssl首选服务器上的密码;
#地点/{
#根html;
#index.html index.htm;
# }
#}
}
Hmmm。。。你能澄清你的评论吗?同时,我在phpMyAdmin的服务器块中没有看到任何listen指令。另外,考虑将PHPMyAdmin移动到C:\MHServer \WWW \ PHPMyAdmin?是否更新了PHPMyAdmin的路径?或者尝试使用NGINX将文件夹名location/phpMyAdmin{
更改为location/phpMyAdmin{
,您的配置不会启动。注:我正在使用NGINX 1.5.2tanks。它对我有效。我将根文件夹名更改为html。
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;
}
}
#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;
# }
#}
}