1

我的 nginx 配置有问题。我们公司有一个流浪者盒子。在这个 vagrant 中,我们有用于服务的 LXC 容器,例如 nginx 容器、php-fpm 容器、memcached 容器、mysql 容器……这些容器相互连接,nginx 使用 php-fpm,php-fpm 使用 memcached 和 mysql。我可以通过 https 访问 vagrant 之外的 nginx。这是我的nginx配置:

nginx.conf:

user              nginx  nginx;

worker_processes  4;

pid        /var/run/nginx.pid;

worker_rlimit_nofile 1024;

events {
        worker_connections 2048;
        use epoll;
        multi_accept on;
}


http {

       include /etc/nginx/mime.types;
        default_type application/octet-stream;
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        access_log "/var/log/nginx/access.log";
        error_log "/var/log/nginx/error.log";
        keepalive_timeout 120;

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

server {
   listen *:80;
   server_name vagrant.ceg.com;
   return 301 'https://$server_name$request_uri';
}

https.conf:

server {
   listen *:443;
   ssl on;
   ssl_certificate ....crt;
   ssl_certificate_key ....key;
   server_name vagrant.ceg.com www.vagrant.ceg.com;
   root "/srv/www";
   index index.php;
   location / {
       autoindex on;

   }
   location ~ \.php$ {
       include /etc/nginx/fastcgi_params;
       fastcgi_param ENVIRONMENT dev;
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
       fastcgi_index index.php;
       if (-f $request_filename) {
       fastcgi_pass 192.168.42.114:9000;
   }

   }
}

当我在浏览器中打开它时,我得到了 index.php,但速度很慢,而且我在控制台上也遇到了同样的错误,如下所示:

https://www.vagrant.ceg.com/cdn/util/scale/320/320/dev-employer-images/0636443e3076af9d24ba2b1711f57fb47b60f289.jpg Failed to load resource: net::ERR_CONNECTION_TIMED_OUT
4

0 回答 0