gpt4 book ai didi

php - 如何在nginx服务器中创建虚拟主机?和 ajax 调用

转载 作者:行者123 更新时间:2023-11-29 22:36:10 25 4
gpt4 key购买 nike

我使用的是 WT-NMP 软件,结合了 php、mysql 和 ngnix 服务器。

worker_processes  1;




events {
worker_connections 1024;
}


http {

server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
ssi off;

#Timeouts
client_body_timeout 5;
client_header_timeout 5;
keepalive_timeout 25 25;
send_timeout 15s;
resolver_timeout 3s;

#Directive sets timeout period for connection with FastCGI-server. It should be noted that this value can't exceed 75 seconds.
fastcgi_connect_timeout 5s;

#Directive sets the amount of time for upstream to wait for a fastcgi process to send data. Change this directive if you have long running fastcgi processes that do not produce output until they have finished processing. If you are seeing an upstream timed out error in the error log, then increase this parameter to something more appropriate.
fastcgi_read_timeout 40s;

#Directive specifies request timeout to the server. The timeout is calculated between two write operations, not for the whole request. If no data have been written during this period then serve closes the connection.
fastcgi_send_timeout 15s;


fastcgi_buffers 8 32k;
fastcgi_buffer_size 32k;
#fastcgi_busy_buffers_size 256k;
#fastcgi_temp_file_write_size 256k;

open_file_cache off;


#php max upload limit cannot be larger than this
client_max_body_size 8m;
####client_body_buffer_size 1K;
client_header_buffer_size 1k;
large_client_header_buffers 2 1k;
types_hash_max_size 2048;




include nginx.mimetypes.conf;
default_type text/html;

##
# Logging Settings
##
access_log "c:/wt-nmp/log/nginx_access.log";
error_log "c:/wt-nmp/log/nginx_error.log" warn; #debug or warn
log_not_found on; #enables or disables messages in error_log about files not found on disk.
rewrite_log off;

#Leave this off
fastcgi_intercept_errors off;


gzip off;

index index.php index.htm index.html;

server {
listen 127.0.0.1:80 default_server;
listen 127.0.0.1:8080;
#listen [::1]:80 ipv6only=on;

server_name mylocalhost;

root "c:/wt-nmp/www/projectname";

autoindex on;
error_log "c:/wt-nmp/log/nginx_error.log";

allow 127.0.0.1;
#allow ::1;
deny all;

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


#tools are now served from wt-nmp/include/tools/
location ~ ^/tools/.*\.php$ {
root "c:/wt-nmp/include";
try_files $uri =404;
include nginx.fastcgi.conf;
fastcgi_pass php_farm;
}
location ~ ^/tools/ {
root "c:/wt-nmp/include";
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_pass php_farm;
include nginx.fastcgi.conf;
}



}



include domains.d/*.conf;


include nginx.phpfarm.conf;



}

当我尝试使用“mylocalhost”访问时,当我触发事件并调用 ajax 方法时,它工作正常。它给出页面未找到消息

最佳答案

WT-NMP - portable Nginx Mysql Php development stack for Windows README.md 指出:

Starting only one PHP-CGI server with wt-nmp.exe --phpCgiServers=1 will result in slow ajax requests since Nginx will not be able to process PHP scripts simultaneous.

因此,请确保您使用最新版本的 WT-NMP 并选择至少 3 个 PHP-CGI 服务器。

关于php - 如何在nginx服务器中创建虚拟主机?和 ajax 调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29538090/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com