1

我对 nginx 很陌生。我使用过 apache2,但是当我决定尝试在树莓派 2 上托管我的网站时,建议使用 nginx。我使用 https 和商业 ssl 设置了我的设置。我在监狱中的 FreeNAS 上安装了鳄梨酱(仍在尝试让 RDP 到 Windows 10 工作......),甚至转发了防火墙中的 8080 端口以供外部访问。当我尝试访问http://website.com:8080/guacamole时,它​​会自动更改为 https 并显示以下内容:

    Secure Connection Failed

An error occurred during a connection to website.com:8080. SSL received a record that exceeded the maximum permissible length. Error code: SSL_ERROR_RX_RECORD_TOO_LONG

    The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
    Please contact the website owners to inform them of this problem.

但是,当我通过http://IPaddress:8080/guacamole访问它时,它工作得很好。

这是我启用的站点文件:

server {
listen 80;
server_name website.com www.website.com;
    location /guacamole/ {
        proxy_pass http://website.com:8080/guacamole/;
        proxy_buffering off;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $http_connection;
        access_log off;
    }
    ######  phpMyAdmin  ############################################################
    location /phpmyadmin {
        root /usr/share/;
        index index.php index.html index.htm;
        location ~ ^/phpmyadmin/(.+\.php)$ {
            root /usr/share/;
            #include fastcgi-gen.conf;
           fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include /etc/nginx/fastcgi_params;
            fastcgi_buffer_size 128k;
            fastcgi_buffers 256 4k;
            fastcgi_busy_buffers_size 256k;
            fastcgi_temp_file_write_size 256k;
            fastcgi_read_timeout 240;
        }
        location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
            root /usr/share/;
        }
    }
    location /phpMyAdmin {
        rewrite ^/* /phpmyadmin last;
    }
}

server {
listen 443 ssl;
    server_name website.com www.website.com;

    ssl_certificate          /etc/nginx/ssl/website.com_bundle.crt;
    ssl_certificate_key      /etc/nginx/ssl/website.com.key;

    root /data/website.com/www;
    index index.php index.html index.htm;

    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /data/website.com/www;
    }

    # Error & Access logs
    error_log /data/website.com/logs/error.log error;
    access_log /data/website.com/logs/access.log;

    location / {
        index index.html index.php;
    }

    ######  phpMyAdmin  ############################################################
    location /phpmyadmin {
        root /usr/share/;
        index index.php index.html index.htm;
        location ~ ^/phpmyadmin/(.+\.php)$ {
            root /usr/share/;
            #include fastcgi-gen.conf;
           fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include /etc/nginx/fastcgi_params;
            fastcgi_buffer_size 128k;
            fastcgi_buffers 256 4k;
            fastcgi_busy_buffers_size 256k;
            fastcgi_temp_file_write_size 256k;
            fastcgi_read_timeout 240;
        }
        location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
            root /usr/share/;
        }
    }
    location /phpMyAdmin {
        rewrite ^/* /phpmyadmin last;
    }

    location ~ \.php(?:$|/) {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param HTTPS on;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        #server unix:/var/run/php5-fpm.sock;
    }
}

任何帮助,将不胜感激!

4

0 回答 0