端口8080
上具有主机名窗口的Nginx虚拟主机配置不起作用!
我有Windows 10和apache一起运行xampp,但需要使用nginx进行测试我已经下载了gninx的最新版本并在端口8080
上设置了此设置:
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
include mime.types;
include proxy.conf;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_comp_level 5;
gzip_http_version 1.0;
gzip_min_length 0;
gzip_types text/plain text/html text/css image/x-icon application/x-javascript;
gzip_vary on;
server {
listen *:8080;
server_name www.ngt1.me ngt1.me;
#charset utf-8;
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm)$
{
root "C:/xampp/htdocs/dev/ngt1/";
index index.php index.html index.htm;
expires max;
}
location /phpmyadmin {
proxy_pass http://127.0.0.1:8080/phpmyadmin;
allow 127.0.0.1;
deny all;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
proxy_pass http://127.0.0.1:8080;
}
location / {
proxy_pass http://127.0.0.1:8080;
}
}
}
此代理设置:
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 20m;
client_body_buffer_size 256k;
client_header_buffer_size 256k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 32k;
proxy_buffers 64 32k;
proxy_busy_buffers_size 128k;
Windows主机文件,以防止使用URL上的端口:8080
127.0.0.1:8080 www.ngt1.me
127.0.0.1:8080 ngt1.me
当我尝试运行nginx时,它开始运行,但是我却得到DNS_PROBE_FINISHED_NXDOMAIN
,并且我无法使用apache使用的端口80。
我有刷新DNS,然后重新启动PC,但在Google中找不到任何相关内容