Welcome! Log In Create A New Profile

Advanced

Re: Как заставить nginx редиректить https на http, или не работает iframe

February 19, 2020 06:54AM
Идея такая:
Вместо http://127.0.0.1:8085 http://127.0.0.1:8085/ напиши https://mydomain.ru/stranica-src https://mydomain.ru/stranica-src. И location /stranica-src { proxy-pass http://127.0.0.1:8085 http://127.0.0.1:8085/; }


> 19 февр. 2020 г., в 14:46, sergius_anp <nginx-forum@forum.nginx.org> написал(а):
>
> Доброго времени суток всем! Я новичок! Недавно столкнулся с проблемой,
> которая уже 3 день не дает мне покоя.
> Вводные: centos 7 + nginx + php72 + wordpress, сайт работает все редиректы
> (www - /; http - https) выполняются, но стоит задача через iframe добавить
> на сайт веб-приложение, работающее с этого же сервера по адресу
> http://127.0.0.1:8085
> Но т.к. веб-приложение ходит по http сайт работающий по https страницу не
> открывает, ругаясь на отсутствие SSL сертификата.
> То есть https://mydomain.ru/stranica на странице <iframe
> src="http://127.0.0.1:8085" width="500px" height="800px" frameborder="1"
> scrolling="yes" align="left"> </iframe> и он не показывает. Пробовал
> запускать на другом сайте, который работал по http - все нормально
> запустилось и работало.
> мой nginx.conf
>
> server {
> listen 80;
> server_name mydomain.ru;
> root /var/www/mydomain.ru/www/;
> index index.php index.html index.htm;
> access_log /var/www/mydomain.ru/www/log/access.log main;
> error_log /var/www/mydomain.ru/www/log/error.log;
>
> location / {
> return 301 https://mydomain.ru$request_uri;
> }
>
> location ~* ^.+.(js|css|png|jpg|jpeg|gif|ico|woff)$ {
> return 301 https://mydomain.ru$request_uri;
> }
>
> location ~ \.php$ {
> return 301 https://mydomain.ru$request_uri;
> }
>
> location = /favicon.ico {
> log_not_found off;
> access_log off;
> }
>
> location = /robots.txt {
> rewrite ^ /robots.txt break;
> allow all;
> log_not_found off;
> access_log off;
> }
>
> location ~ /\.ht {
> deny all;
> }
> }
>
> server {
> listen 80;
> server_name www.mydomain.ru;
> rewrite ^ https://mydomainru$request_uri? permanent;
> }
>
> server {
> listen 443 ssl http2;
> server_name mydomain.ru;
> root /var/wwwmydomain.ru/www/;
> index index.php index.html index.htm;
> access_log /var/www/mydomain.ru/www/log/ssl-access.log main;
> error_log /var/www/mydomain.ru/www/log/ssl-error.log;
>
> keepalive_timeout 60;
> ssl_certificate
> /etc/letsencrypt/live/mydomain.ru/fullchain.pem;
> ssl_certificate_key
> /etc/letsencrypt/live/mydomain.ru/privkey.pem;
> ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
> ssl_ciphers
> 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
> ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
> add_header Strict-Transport-Security 'max-age=604800';
>
> location / {
> try_files $uri $uri/ /index.php?$args;
> }
>
> location ~* ^.+.(js|css|png|jpg|jpeg|gif|ico|woff)$ {
> access_log off;
> expires max;
> }
>
> location ~ \.php$ {
> try_files $uri =404;
> fastcgi_pass unix:/var/run/php72-fpm.sock;
> #fastcgi_pass 127.0.0.1:9000;
> fastcgi_index index.php;
> fastcgi_param DOCUMENT_ROOT /var/www/mydomain.ru/www/;
> fastcgi_param SCRIPT_FILENAME
> /var/www/mydomain.ru/www$fastcgi_script_name;
> fastcgi_param PATH_TRANSLATED
> /var/www/mydomain.ru/www$fastcgi_script_name;
> include fastcgi_params;
> fastcgi_param QUERY_STRING $query_string;
> fastcgi_param REQUEST_METHOD $request_method;
> fastcgi_param CONTENT_TYPE $content_type;
> fastcgi_param CONTENT_LENGTH $content_length;
> fastcgi_param HTTPS on;
> fastcgi_intercept_errors on;
> fastcgi_ignore_client_abort off;
> fastcgi_connect_timeout 60;
> fastcgi_send_timeout 180;
> fastcgi_read_timeout 180;
> fastcgi_buffer_size 128k;
> fastcgi_buffers 4 256k;
> fastcgi_busy_buffers_size 256k;
> fastcgi_temp_file_write_size 256k;
> }
>
> location = /favicon.ico {
> log_not_found off;
> access_log off;
> }
>
> location = /robots.txt {
> allow all;
> log_not_found off;
> access_log off;
> }
>
> location = /robots.txt {
> allow all;
> log_not_found off;
> access_log off;
> }
>
> location ~ /\.ht {
> deny all;
> }
> }
>
> server {
> listen 443 ssl http2;
> server_name www.mydomain.ru;
> rewrite ^ https://mydomain.ru$request_uri? permanent;
>
> Помогите, укажите перстом куда и чего написать чтобы все работало нормально?
> Почитав интернеты понял что дело точно в https to http, вот только как его
> правильно сделать применимо к моему конфигу не пойму.
>
> Posted at Nginx Forum: https://forum.nginx.org/read.php?21,287055,287055#msg-287055
>
> _______________________________________________
> nginx-ru mailing list
> nginx-ru@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-ru

_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

Как заставить nginx редиректить https на http, или не работает iframe

sergius_anp February 19, 2020 06:46AM

Re: Как заставить nginx редиректить https на http, или не работает iframe

imsystem February 19, 2020 06:54AM

Re: Как заставить nginx редиректить https на http, или не работает iframe

sergius_anp February 19, 2020 07:49AM

Re: Как заставить nginx редиректить https на http, или не работает iframe

imsystem February 19, 2020 07:58AM

Re: Как заставить nginx редиректить https на http, или не работает iframe

sergius_anp February 19, 2020 09:01AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 282
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready