• Как передать в Laravel настоящий IP?

    0xc00000e9
    @0xc00000e9 Автор вопроса
    Ну, там написано, что он изначально не включён. Как включить этот модуль в докере, не знаете?
  • Как передать в Laravel настоящий IP?

    0xc00000e9
    @0xc00000e9 Автор вопроса
    Danila534, не откуда брать ip, его сервер банально не видит
  • Как передать в Laravel настоящий IP?

    0xc00000e9
    @0xc00000e9 Автор вопроса
    Гуглил, целый день. И на это решение тоже натыкался, но этих заголовков банально нету в ответе от сервера
  • Как передать в Laravel настоящий IP?

    0xc00000e9
    @0xc00000e9 Автор вопроса
    Сергей Соколов,
    ответ сервера

    "PHP_EXTRA_CONFIGURE_ARGS" => "--enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --disable-cgi"
      "HOSTNAME" => "2dfa3b3ae139"
      "PHP_INI_DIR" => "/usr/local/etc/php"
      "SHLVL" => "1"
      "HOME" => "/home/www-data"
      "PHP_LDFLAGS" => "-Wl,-O1 -pie"
      "PHP_CFLAGS" => "-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
      "PHP_VERSION" => "7.4.13"
      "GPG_KEYS" => "42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312"
      "PHP_CPPFLAGS" => "-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
      "PHP_ASC_URL" => "https://www.php.net/distributions/php-7.4.13.tar.xz.asc"
      "PHP_URL" => "https://www.php.net/distributions/php-7.4.13.tar.xz"
      "PATH" => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
      "PHPIZE_DEPS" => "autoconf \t\tdpkg-dev dpkg \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkgconf \t\tre2c"
      "PWD" => "/var/www/html"
      "PHP_SHA256" => "aead303e3abac23106529560547baebbedba0bb2943b91d5aa08fff1f41680f4"
      "USER" => "www-data"
      "HTTP_ACCEPT_LANGUAGE" => "ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7"
      "HTTP_ACCEPT_ENCODING" => "gzip, deflate"
      "HTTP_ACCEPT" => "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
      "HTTP_USER_AGENT" => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
      "HTTP_UPGRADE_INSECURE_REQUESTS" => "1"
      "HTTP_CONNECTION" => "keep-alive"
      "HTTP_HOST" => "<тут мой настоящий ip>:3000"
      "PATH_INFO" => ""
      "SCRIPT_FILENAME" => "/var/www/html/public/index.php"
      "REDIRECT_STATUS" => "200"
      "SERVER_NAME" => ""
      "SERVER_PORT" => "80"
      "SERVER_ADDR" => "172.18.0.5"
      "REMOTE_PORT" => "40958"
      "REMOTE_ADDR" => "172.18.0.1"
      "SERVER_SOFTWARE" => "nginx/1.18.0"
      "GATEWAY_INTERFACE" => "CGI/1.1"
      "REQUEST_SCHEME" => "http"
      "SERVER_PROTOCOL" => "HTTP/1.1"
      "DOCUMENT_ROOT" => "/var/www/html/public"
      "DOCUMENT_URI" => "/index.php"
      "REQUEST_URI" => "/"
      "SCRIPT_NAME" => "/index.php"
      "CONTENT_LENGTH" => ""
      "CONTENT_TYPE" => ""
      "REQUEST_METHOD" => "GET"
      "QUERY_STRING" => ""
      "FCGI_ROLE" => "RESPONDER"
      "PHP_SELF" => "/index.php"
      "REQUEST_TIME_FLOAT" => 1609530236.3016
      "REQUEST_TIME" => 1609530236
      "argv" => []
      "argc" => 0
      "APP_NAME" => "Laravel"
      "APP_ENV" => "local"
      "APP_KEY" => "base64:fo+1ldhqWUypHuR/jc3uHzw7fDVr61rqXhXkAbSbtCo="
      "APP_DEBUG" => "true"
      "APP_URL" => "http://ads-master.test"
      "LOG_CHANNEL" => "stack"
      "DB_CONNECTION" => "mysql"
      "DB_HOST" => "db"
      "DB_PORT" => "3306"
      "DB_DATABASE" => "ads_master"
      "DB_USERNAME" => "root"
      "DB_PASSWORD" => "root"
      "BROADCAST_DRIVER" => "log"
      "CACHE_DRIVER" => "file"
      "QUEUE_CONNECTION" => "sync"
      "SESSION_DRIVER" => "file"
      "SESSION_LIFETIME" => "120"
      "REDIS_HOST" => "127.0.0.1"
      "REDIS_PASSWORD" => "null"
      "REDIS_PORT" => "6379"
      "MAIL_MAILER" => "smtp"
      "MAIL_HOST" => "smtp.mailtrap.io"
      "MAIL_PORT" => "2525"
      "MAIL_USERNAME" => "null"
      "MAIL_PASSWORD" => "null"
      "MAIL_ENCRYPTION" => "null"
      "MAIL_FROM_ADDRESS" => "null"
      "MAIL_FROM_NAME" => "Laravel"
      "AWS_ACCESS_KEY_ID" => ""
      "AWS_SECRET_ACCESS_KEY" => ""
      "AWS_DEFAULT_REGION" => "us-east-1"
      "AWS_BUCKET" => ""
      "PUSHER_APP_ID" => ""
      "PUSHER_APP_KEY" => ""
      "PUSHER_APP_SECRET" => ""
      "PUSHER_APP_CLUSTER" => "mt1"
      "MIX_PUSHER_APP_KEY" => ""
      "MIX_PUSHER_APP_CLUSTER" => "mt1"

  • Как передать в Laravel настоящий IP?

    0xc00000e9
    @0xc00000e9 Автор вопроса
    Сергей Соколов,
    конфиг nginx

    server {
        listen          80;
        root            /var/www/html/public;
        index           index.php;
    
        error_log  /var/log/nginx/error.log;
        access_log /var/log/nginx/access.log;
    
        location / {
    		proxy_set_header			X-Real-IP		$remote_addr;
    
    		try_files   $uri $uri/ /index.php;
        }
    
        location ~* \.(js|css|gif|png|jp?g|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|oex|xpi|safariextz|vcf)(\?[0-9]+)?$ {
            expires max;
            log_not_found off;
        }
    
        location ~ \.php$ {
            try_files                   $uri =404;
            fastcgi_index               index.php;
            fastcgi_split_path_info     ^(.+\.php)(/.+)$;
            fastcgi_pass                php:9000;
            include                     fastcgi_params;
            fastcgi_param               SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param               PATH_INFO       $fastcgi_path_info;
            fastcgi_read_timeout        300;
        }
    }

  • Как передать в Laravel настоящий IP?

    0xc00000e9
    @0xc00000e9 Автор вопроса
    Я думаю, что дело тут в докере... Но настроен он по сути правильно.
    конфиг docker-compose
    version: '3'
    
    networks:
      laravel:
    
    services:
      nginx:
        image: nginx:stable-alpine
        container_name: nginx
        ports:
          - mode: host
            protocol: tcp
            published: 3000
            target: 80
          - mode: host
            protocol: tcp
            published: 443
            target: 81
        volumes:
          - ./:/var/www/html
          - ./docker-compose/nginx/default.conf:/etc/nginx/conf.d/default.conf
        depends_on:
          - php
          - db
          - phpmyadmin
        networks:
          - laravel
    
      db:
        image: mysql:5.7.22
        container_name: mysql
        restart: unless-stopped
        tty: true
        ports:
          - "3307:3306"
        volumes:
          - ./docker-compose/mysql:/var/lib/mysql
        environment:
          MYSQL_DATABASE: ads_master
          MYSQL_ROOT_PASSWORD: root
          SERVICE_TAGS: dev
          SERVICE_NAME: mysql
        networks:
          - laravel
    
      php:
        build:
          context: .
          dockerfile: Dockerfile
        container_name: php
        volumes:
          - ./:/var/www/html
        ports:
          - "9000:9000"
        networks:
          - laravel
    
      phpmyadmin:
        image: phpmyadmin/phpmyadmin
        container_name: pma
        restart: always
        links:
          - db
        ports:
          - "3001:80"
        networks:
          - laravel
  • Как передать в Laravel настоящий IP?

    0xc00000e9
    @0xc00000e9 Автор вопроса
    SagePtr, тоже пробовал
  • Как передать в Laravel настоящий IP?

    0xc00000e9
    @0xc00000e9 Автор вопроса
    Сергей Соколов, неа, не работает. Заголовка попросту нету в ответе от сервера, а remote addr по сути и содержит в себе этот ip докера
  • Какой загрузчик лучше выбрать?

    0xc00000e9
    @0xc00000e9 Автор вопроса
    Дмитрий, комбо - это UEFI with CSM?