Skip to content
This repository has been archived by the owner on Feb 4, 2021. It is now read-only.

NGINX #39

Closed
ghost opened this issue Sep 21, 2016 · 2 comments
Closed

NGINX #39

ghost opened this issue Sep 21, 2016 · 2 comments

Comments

@ghost
Copy link

ghost commented Sep 21, 2016

i'd like to setup a small webserver to test several webstuff.
problem. PHP doesnt work

what are the correct settings ind the conf file ?
ig got this and get 502 on php files

    location / {
        try_files $uri $uri/ /index.html;
    }
    location ~ \.php$ {
        include /etc/nginx/conf/fastcgi.conf;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
   }
@ghost
Copy link
Author

ghost commented Sep 21, 2016

answered myself :)
Dockercompose:

  volumes:
    - /etc/localtime:/etc/localtime
    - /root/.nginx/sites-enabled:/sites-enabled
    - /root/.nginx/conf:/conf.d
    - /root/.nginx/log:/var/log/nginx
    - /root/.nginx/certs:/certs
    - /root/.nginx/htdocs:/www

php:
    container_name: php
    image: php:7-fpm
    volumes:
      - /root/.nginx/htdocs:/www

*.conf

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass php:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }

can be closed

@Wonderfall
Copy link
Owner

Wonderfall commented Sep 21, 2016

Yes, my nginx images do not include php-fpm but only fastcgi module. You just have to use and link a php-fpm container, like php:7-fpm-alpine.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant