{"action":"opened","issue":{"url":"https://api.github.com/repos/pimcore/pimcore/issues/2786","repository_url":"https://api.github.com/repos/pimcore/pimcore","labels_url":"https://api.github.com/repos/pimcore/pimcore/issues/2786/labels{/name}","comments_url":"https://api.github.com/repos/pimcore/pimcore/issues/2786/comments","events_url":"https://api.github.com/repos/pimcore/pimcore/issues/2786/events","html_url":"https://github.com/pimcore/pimcore/issues/2786","id":315568134,"number":2786,"title":"[Installer] Doesn't work with Nginx","user":{"login":"qmaxquique","id":2835975,"avatar_url":"https://avatars0.githubusercontent.com/u/2835975?v=4","gravatar_id":"","url":"https://api.github.com/users/qmaxquique","html_url":"https://github.com/qmaxquique","followers_url":"https://api.github.com/users/qmaxquique/followers","following_url":"https://api.github.com/users/qmaxquique/following{/other_user}","gists_url":"https://api.github.com/users/qmaxquique/gists{/gist_id}","starred_url":"https://api.github.com/users/qmaxquique/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qmaxquique/subscriptions","organizations_url":"https://api.github.com/users/qmaxquique/orgs","repos_url":"https://api.github.com/users/qmaxquique/repos","events_url":"https://api.github.com/users/qmaxquique/events{/privacy}","received_events_url":"https://api.github.com/users/qmaxquique/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-18T17:14:05Z","updated_at":"2018-04-18T17:14:05Z","closed_at":null,"author_association":"NONE","body":"## Can't get the GUI installer in a fresh nginx/php-fpm installation\r\n \r\n### Expected behavior \r\nGet the GUI installer.\r\n\r\n### Actual behavior  \r\nI got redirected to /install and then the server responds with a 404\r\n\r\n _(This seems to be different than #2008)_ \r\n\r\n---\r\n\r\n### Steps to reproduce  \r\n\r\n**I start by creating a docker compose file, to get my test containers up and running**\r\n```shell\r\n┌─[root@core]─(~/pimcore)\r\n└─[06:58]# cat docker-compose.yml\r\nversion: '2.0'\r\nservices:\r\n  redis:\r\n    image: redis:alpine\r\n    container_name: redis\r\n\r\n  mariadb:\r\n    image: mariadb:10.1\r\n    container_name: mariadb\r\n    command: [mysqld, --character-set-server=utf8mb4, --collation-server=utf8mb4_unicode_ci]\r\n    volumes:\r\n      - pimcore-database:/var/lib/mysql\r\n    environment:\r\n      - MYSQL_ROOT_PASSWORD=ROOT\r\n      - MYSQL_DATABASE=pimcore\r\n      - MYSQL_USER=pimcore\r\n      - MYSQL_PASSWORD=pimcore\r\n\r\n  webserver:\r\n    image: centos\r\n    container_name: nginx\r\n    working_dir: /var/www\r\n    command: [sleep, infinity]\r\n    ports:\r\n     - \"80:80\"\r\n    links:\r\n     - mariadb:mariadb\r\n     - redis:redis\r\n\r\nvolumes:\r\n  pimcore-database:\r\n```\r\n**Here I start my test containers**\r\n```\r\n┌─[root@core]─(~/pimcore)\r\n└─[06:58]# docker-compose up -d\r\nCreating network \"pimcore_default\" with the default driver\r\nCreating volume \"pimcore_pimcore-database\" with default driver\r\nPulling mariadb (mariadb:10.1)...\r\n10.1: Pulling from library/mariadb\r\n...\r\nDigest: sha256:6e545933369f30ec92678df835d37821ab7b8501fce189cbff4ec26e34e8b419\r\nStatus: Downloaded newer image for mariadb:10.1\r\nPulling redis (redis:alpine)...\r\nalpine: Pulling from library/redis\r\n...\r\nDigest: sha256:e6e3a62b67b4e5c956b8814ac64ce3fe531c1093606f2a4fe5492921f6592388\r\nStatus: Downloaded newer image for redis:alpine\r\nPulling webserver (centos:latest)...\r\nlatest: Pulling from library/centos\r\n...\r\nDigest: sha256:989b936d56b1ace20ddf855a301741e52abca38286382cba7f44443210e96d16\r\nStatus: Downloaded newer image for centos:latest\r\nCreating redis\r\nCreating mariadb\r\nCreating nginx\r\n\r\n\r\n┌─[root@core]─(~/pimcore)\r\n└─[06:59]# docker-compose ps\r\n Name                Command               State         Ports\r\n---------------------------------------------------------------------\r\nmariadb   docker-entrypoint.sh mysql ...   Up      3306/tcp\r\nnginx     sleep infinity                   Up      0.0.0.0:80->80/tcp\r\nredis     docker-entrypoint.sh redis ...   Up      6379/tcp\r\n\r\n ```\r\n**Nginx and php Installation**\r\n```\r\n# I access the nginx container to install Nginx...\r\n┌─[root@core]─(~/pimcore)\r\n└─[07:02]# docker exec -it nginx /bin/bash\r\n\r\n[root@35f0aa8afb40 www]# pwd\r\n/var/www\r\n[root@35f0aa8afb40 www]# yum -y install epel-release && yum -y update && yum -y install nginx\r\n...\r\n\r\n# and PHP...\r\n[root@35f0aa8afb40 www]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm && yum -y update\r\n...\r\n\r\n[root@35f0aa8afb40 www]# yum -y install php71w php71w-mysqli php71w-fpm php71w-gd php71w-cli php71w-iconv php71w-dom \\\r\nphp71w-simplexml php71w-exif php71w-fileinfo php71w-mbstring php71w-zlib php71w-zip php71w-bz2 php71w-openssl \\\r\nphp71w-opcache php71w-curl php71w-pecl-redis ImageMagick unzip wget\r\n...\r\n\r\n# and I test the versions\r\n[root@35f0aa8afb40 www]# nginx -V\r\nnginx version: nginx/1.12.2\r\nbuilt by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)\r\nbuilt with OpenSSL 1.0.2k-fips  26 Jan 2017\r\nTLS SNI support enabled\r\nconfigure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules \\\r\n--conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log \\\r\n--http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy \\\r\n--http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi \\\r\n--http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx \\\r\n--user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_auth_request_module --with-http_ssl_module \\\r\n--with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic \\\r\n--with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module \\\r\n--with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module \\\r\n--with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module \\\r\n--with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre \\\r\n--with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-google_perftools_module --with-debug \\\r\n--with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong \\\r\n--param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' \\\r\n--with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E'\r\n\r\n[root@35f0aa8afb40 www]# php -v\r\nPHP 7.1.14 (cli) (built: Feb  4 2018 09:05:29) ( NTS )\r\nCopyright (c) 1997-2018 The PHP Group\r\nZend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies\r\n    with Zend OPcache v7.1.14, Copyright (c) 1999-2018, by Zend Technologies\r\n\r\n```\r\n\r\n**I edit the PHP pool file, to match with the pimcore default configuration (Only changed the first 6 lines shown)**\r\n```\r\n[root@35f0aa8afb40 www]# cat /etc/php-fpm.d/www.conf  | grep -v '^$' | grep -v ^\\;\r\n[www]\r\nuser = nginx\r\ngroup = nginx\r\nlisten = /var/run/php/pimcore5.sock;\r\nlisten.owner = nginx\r\nlisten.group = nginx\r\nlisten.mode = 0660\r\npm = dynamic\r\npm.max_children = 50\r\npm.start_servers = 5\r\npm.min_spare_servers = 5\r\npm.max_spare_servers = 35\r\nslowlog = /var/log/php-fpm/www-slow.log\r\nphp_admin_value[error_log] = /var/log/php-fpm/www-error.log\r\nphp_admin_flag[log_errors] = on\r\nphp_value[session.save_handler] = files\r\nphp_value[session.save_path]    = /var/lib/php/session\r\nphp_value[soap.wsdl_cache_dir]  = /var/lib/php/wsdlcache\r\n```\r\n\r\n**I make the directory where the socket will be created**\r\n```\r\n[root@35f0aa8afb40 www]# mkdir -p /var/run/php\r\n[root@35f0aa8afb40 www]# chown nginx:nginx /var/run/php\r\n```\r\n\r\n**Nginx server block configuration**\r\nI get the exact nginx config from the Pimcore documentation  here https://pimcore.com/docs/5.x/Development_Documentation/Installation_and_Upgrade/System_Setup_and_Hosting/Nginx_Configuration.html\r\n```\r\n[root@35f0aa8afb40 www]# cat > /etc/nginx/conf.d/pimcore.conf\r\n# <I pasted here the server block copied from the URL above>\r\n...\r\n\r\n# I change the server_name to match the name of my own test server\r\n[root@35f0aa8afb40 www]# sed -i 's/pimcore.loc/core/g' /etc/nginx/conf.d/pimcore.conf\r\n\r\n# .. and I test the nginx config:\r\n[root@35f0aa8afb40 www]# nginx -t\r\nnginx: the configuration file /etc/nginx/nginx.conf syntax is ok\r\nnginx: configuration file /etc/nginx/nginx.conf test is successful\r\n```\r\n\r\n**Pimcore code retrieval** \r\n```\r\n[root@35f0aa8afb40 www]# wget http://pimcore.com/download-5/pimcore-stable.zip\r\n--2018-04-18 14:49:51--  http://pimcore.com/download-5/pimcore-stable.zip\r\nResolving pimcore.com (pimcore.com)... 62.138.199.172\r\nConnecting to pimcore.com (pimcore.com)|62.138.199.172|:80... connected.\r\nHTTP request sent, awaiting response... 301 Moved Permanently\r\nLocation: https://pimcore.com/download-5/pimcore-stable.zip [following]\r\n--2018-04-18 14:49:51--  https://pimcore.com/download-5/pimcore-stable.zip\r\nConnecting to pimcore.com (pimcore.com)|62.138.199.172|:443... connected.\r\nHTTP request sent, awaiting response... 200 OK\r\nLength: 208017675 (198M) [application/zip]\r\nSaving to: 'pimcore-stable.zip'\r\n\r\n100%[==================================================================================================================>] 208,017,675 11.2MB/s   in 19s\r\n\r\n2018-04-18 14:50:11 (10.3 MB/s) - 'pimcore-stable.zip' saved [208017675/208017675]\r\n\r\n[root@35f0aa8afb40 www]# unzip pimcore-stable.zip -d pimcore\r\n...\r\n\r\n\r\n# I set the permissions (Less restrictive than https://pimcore.com/docs/5.x/Development_Documentation/Installation_and_Upgrade/System_Setup_and_Hosting/File_Permissions.html)\r\n[root@35f0aa8afb40 www]# chown -R nginx:nginx pimcore\r\n[root@35f0aa8afb40 www]# chmod -R ug+x pimcore\r\n```\r\n\r\n\r\n**Finally I start the services**\r\n```\r\n[root@35f0aa8afb40 www]# php-fpm\r\n[root@35f0aa8afb40 www]# nginx\r\n[root@35f0aa8afb40 www]# ps -ef\r\nUID        PID  PPID  C STIME TTY          TIME CMD\r\nroot         1     0  0 13:59 ?        00:00:00 sleep infinity\r\nroot         5     0  0 14:02 ?        00:00:00 /bin/bash\r\nroot       495     0  0 14:57 ?        00:00:00 php-fpm: master process (/etc/php-fpm.conf)\r\nnginx      496   495  0 14:57 ?        00:00:00 php-fpm: pool www\r\nnginx      497   495  0 14:57 ?        00:00:00 php-fpm: pool www\r\nnginx      498   495  0 14:57 ?        00:00:00 php-fpm: pool www\r\nnginx      499   495  0 14:57 ?        00:00:00 php-fpm: pool www\r\nnginx      500   495  0 14:57 ?        00:00:00 php-fpm: pool www\r\nroot       502     0  0 14:57 ?        00:00:00 nginx: master process nginx\r\nnginx      503   502  0 14:57 ?        00:00:00 nginx: worker process\r\nnginx      504   502  0 14:57 ?        00:00:00 nginx: worker process\r\nroot       505     5  0 14:57 ?        00:00:00 ps -ef\r\n\r\n# FPM socket\r\n[root@35f0aa8afb40 www]# ls -l /var/run/php/pimcore5.sock\r\nsrw-rw---- 1 nginx nginx 0 Apr 18 15:00 /var/run/php/pimcore5.sock\r\n```\r\n\r\n---\r\n\r\n**At this point, If I test http://core I just get a PHP file called \"Install\" as it's not processing the source as PHP. Trying to solve this, I go to the server block and search for the setup path, making the proper changes.**\r\n\r\n```\r\n    # Use this location when the installer has to be run\r\n    location ~ /(app|install)\\.php(/|$) { # I've uncommmented this line\r\n    #\r\n    # Use this after initial install is done: # ... and commented this one\r\n    #location ~ ^/app\\.php(/|$) {\r\n```\r\n```\r\n# I also restart nginx:\r\n[root@35f0aa8afb40 www]# pkill nginx\r\n[root@35f0aa8afb40 www]# nginx -t\r\nnginx: the configuration file /etc/nginx/nginx.conf syntax is ok\r\nnginx: configuration file /etc/nginx/nginx.conf test is successful\r\n[root@35f0aa8afb40 www]# nginx\r\n```\r\n\r\n\r\n### When I try again, after a couple redirections, I get a 404 (see in below)\r\n```\r\nMacBook-Pro-2:~ enrique$ curl http://core\r\n<!DOCTYPE html>\r\n<html>\r\n    <head>\r\n        <meta charset=\"UTF-8\" />\r\n        <meta http-equiv=\"refresh\" content=\"0;url=/install\" />\r\n\r\n        <title>Redirecting to /install</title>\r\n    </head>\r\n    <body>\r\n        Redirecting to <a href=\"/install\">/install</a>.\r\n    </body>\r\n</html>\r\n\r\nMacBook-Pro-2:~ enrique$ curl http://core/install\r\n<!DOCTYPE html>\r\n<html>\r\n    <head>\r\n        <meta charset=\"UTF-8\" />\r\n        <meta http-equiv=\"refresh\" content=\"0;url=http://core/install/\" />\r\n\r\n        <title>Redirecting to http://core/install/</title>\r\n    </head>\r\n    <body>\r\n        Redirecting to <a href=\"http://core/install/\">http://core/install/</a>.\r\n    </body>\r\n</html>\r\n\r\nMacBook-Pro-2:~ enrique$ curl http://core/install/\r\n<html>\r\n<head><title>404 Not Found</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>404 Not Found</h1></center>\r\n<hr><center>nginx/1.12.2</center>\r\n</body>\r\n</html>\r\n\r\n```"}}
{"actor":{"display_login":"qmaxquique"}}