2017-10-05 73 views
0

我使用Homestead作爲我的開發環境。作爲虛擬機提供商,我使用VirtualBox。我的網站經常掛起,直到我重新加載後纔會響應流浪漢。有人有同樣的問題嗎?在Homestead虛擬機上託管的網站在幾分鐘後不響應

我注意到,當我取消客戶端請求時,它掛起。如果我不這樣做的網站正在工作。

ngixn.conf

worker_processes auto; 
pid /run/nginx.pid; 
include /etc/nginx/modules-enabled/*.conf; 

events { 
     worker_connections 768; 
     # multi_accept on; 
} 

http { 

     ## 
     # Basic Settings 
     ## 

     sendfile on; 
     tcp_nopush on; 
     tcp_nodelay on; 
user vagrant; 
worker_processes auto; 
pid /run/nginx.pid; 
include /etc/nginx/modules-enabled/*.conf; 

events { 
     worker_connections 768; 
     # multi_accept on; 
} 

http { 

     ## 
     # Basic Settings 
     ## 
     { 
     sendfile on; 
     tcp_nopush on; 
}  tcp_nodelay on; 
     keepalive_timeout 65; 
     types_hash_max_size 2048; 
     # server_tokens off; 

     server_names_hash_bucket_size 64; 
                   1,1   To 









     # server_name_in_redirect off; 

     include /etc/nginx/mime.types; 
     default_type application/octet-stream; 

     ## 
     # SSL Settings 
     ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE 
     ssl_prefer_server_ciphers on; 

     ## 
     # Logging Settings 
     ## 

     access_log /var/log/nginx/access.log; 
     error_log /var/log/nginx/error.log; 

     ## 
     # Gzip Settings 
     ## 

     gzip on; 
     gzip_disable "msie6"; 

     # gzip_vary on; 
     # gzip_proxied any; 
     # gzip_comp_level 6; 
     # gzip_buffers 16 8k; 
     # gzip_http_version 1.1; 

     ## 
     # Virtual Host Configs 
     ## 

     include /etc/nginx/conf.d/*.conf; 
     include /etc/nginx/sites-enabled/*; 
} 


#mail { 
#  # See sample authentication script at: 
#  # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript 
# 
#  # auth_http localhost/auth.php; 
#  # pop3_capabilities "TOP" "USER"; 
#  # imap_capabilities "IMAP4rev1" "UIDPLUS"; 
# 
#  server { 
#    listen  localhost:110; 
#    protocol pop3; 
#    proxy  on; 
#  } 
# 
#  server { 
#    listen  localhost:143; 
#    protocol imap; 
#    proxy  on; 
#  } 
#} 

網站服務器

server { 
listen 80; 
listen 443 ssl http2; 
server_name site.dev; 
root "/home/vagrant/Projects/GUIRebuild/public"; 

index index.html index.htm index.php; 

charset utf-8; 

location/{ 
    try_files $uri $uri/ /index.php?$query_string; 
} 

location = /favicon.ico { access_log off; log_not_found off; } 
location = /robots.txt { access_log off; log_not_found off; } 

access_log off; 
error_log /var/log/nginx/site.dev-error.log error; 

sendfile off; 

client_max_body_size 100m; 


location ~ \.php$ { 
    fastcgi_split_path_info ^(.+\.php)(/.+)$; 
    fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; 
    fastcgi_index index.php; 
    include fastcgi_params; 
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 


    fastcgi_intercept_errors off; 
    fastcgi_buffer_size 16k; 
    fastcgi_buffers 4 16k; 
    fastcgi_connect_timeout 300; 
    fastcgi_send_timeout 300; 
    fastcgi_read_timeout 300; 
} 

location ~ /\.ht { 
    deny all; 
} 

ssl_certificate  /etc/nginx/ssl/site.dev.crt; 
ssl_certificate_key /etc/nginx/ssl/site.dev.key; 

}

錯誤日誌

2017/10/06 05:25:48 [error] 3839#3839: *521 upstream timed out (110: Connection 
timed out) while reading response header from upstream, client: 192.168.10.1, se 
rver: devinix.dev, request: "GET /api/auth_state HTTP/1.1", upstream: "fastcgi:/ 
/unix:/var/run/php/php7.1-fpm.sock", host: "devinix.dev", referrer: "http://devi 
nix.dev/" 
2017/10/06 05:27:02 [error] 3839#3839: *523 upstream timed out (110: Connection 
timed out) while reading response header from upstream, client: 192.168.10.1, se 
rver: devinix.dev, request: "GET /api/auth_state HTTP/1.1", upstream: "fastcgi:/ 
/unix:/var/run/php/php7.1-fpm.sock", host: "devinix.dev", referrer: "http://devi 
nix.dev/" 

我是Windows用戶和機器在Ubuntu上工作。

+0

嘗試添加'config.vm.provider「virtualbox」do | v | v.memory = 2048 v.cpus = 2 end'看看它是否有幫助 –

+0

它已經使用2048內存和4 cpus.I dont知道它的nginx問題還是vm。 –

+0

在虛擬機內部使用htop,看看發生了什麼 –

回答

0

我沒有升級我的宅基地版本從3.1到4.0,現在它工作得很好。

相關問題