From 318680cfcf5c5f3b5060065ed1db58054c736123 Mon Sep 17 00:00:00 2001 From: kinou-p Date: Sat, 17 Sep 2022 19:55:27 +0200 Subject: [PATCH] error 403 --- srcs/docker-compose.yml | 42 +++++++++++++------------ srcs/requirements/nginx/Dockerfile | 22 ++++++++++--- srcs/requirements/nginx/conf/nginx.conf | 18 +++++++---- srcs/wordpress/index.php | 0 4 files changed, 52 insertions(+), 30 deletions(-) mode change 100644 => 100755 srcs/wordpress/index.php diff --git a/srcs/docker-compose.yml b/srcs/docker-compose.yml index 744ce92..59f08b9 100644 --- a/srcs/docker-compose.yml +++ b/srcs/docker-compose.yml @@ -3,37 +3,38 @@ version: '3.3' services: nginx: - #build: ./requirements/nginx - image: nginx:stable-alpine + build: ./requirements/nginx + #image: nginx:stable-alpine #container_name: nginx - #depends_on: - # - wordpress - # - mariadb + depends_on: + - php + - mysql ports: - 80:80 - # - 443:443 + - 443:443 volumes: #- wpfiles:/var/www/html - ./wordpress:/var/www/html - - ./requirements/nginx/conf/nginx.conf:/etc/nginx/conf.d/default.conf - #networks: - # - wpnetwork - #restart: always + - ./wordpress:/var/www/html3 + - ./wordpress:/var/www/html2 + #- ./requirements/nginx/conf/nginx.conf:/etc/nginx/conf.d/default.conf + networks: + - wpnetwork + restart: always - wordpress: + php: #build: ./requirements/wordpress image: php:7.4-fpm-alpine - container_name: wordpress volumes: # - wpfiles:/var/www/html - ./wordpress:/var/www/html depends_on: - - php - #networks: - # - wpnetwork + - mysql + networks: + - wpnetwork #restart: always - php: + mysql: #build: ./requirements/mariadb image: mysql:latest #container_name: mariadb @@ -51,12 +52,13 @@ services: #- ./requirements/mariadb:/var/lib/mysql #- wpfiles:/var/www/html - ./wordpress:/var/www/html - #networks: - # - wpnetwork + networks: + - wpnetwork #restart: always -#networks: - # wpnetwork: +networks: + wpnetwork: + driver: bridge #volumes: # wpfiles: \ No newline at end of file diff --git a/srcs/requirements/nginx/Dockerfile b/srcs/requirements/nginx/Dockerfile index 929de0c..973b10e 100644 --- a/srcs/requirements/nginx/Dockerfile +++ b/srcs/requirements/nginx/Dockerfile @@ -12,7 +12,21 @@ FROM debian:buster -RUN apt-get update -RUN apt-get install -y nginx -RUN service nginx restart -RUN ls /var/www/html \ No newline at end of file +RUN su +RUN apt update && apt upgrade -y +RUN apt install nginx sudo -y +#COPY /home/apommier/42/inception/srcs/wordpresse/ var/www/html + +RUN ls var/www/ +#CMD ["echo","-----------new-----------"] +#CMD ["ls","var/www/"] +#CMD ["echo","-----------new-----------"] +#CMD ["ls","var/www/html"] +#CMD ["echo","-----------new-----------"] +#CMD ["ls","var/www/html2"] +#CMD ["echo","-----------new-----------"] +#CMD ["ls","var/www/html3"] +ENTRYPOINT ["nginx","-g","daemon off;"] +#RUN cd var/www/html && ls && cat index.php +#RUN ls var/www/ +#RUN sudo service nginx restart \ No newline at end of file diff --git a/srcs/requirements/nginx/conf/nginx.conf b/srcs/requirements/nginx/conf/nginx.conf index fd32640..0569fa0 100644 --- a/srcs/requirements/nginx/conf/nginx.conf +++ b/srcs/requirements/nginx/conf/nginx.conf @@ -1,23 +1,29 @@ -upstream php { - server unix:/tmp/php-cgi.socket; - server php:3030; -} + server { listen 80; server_name wordpress-docker.test; - root /var/www/html; + root /var/www/html2; index index.php; location / { + autoindex on; + autoindex_exact_size on; try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { + set $upstream php:9000; + + # nginx will now start if host is not reachable + fastcgi_pass $upstream; + fastcgi_index index.php; + + include fastcgi.conf; fastcgi_intercept_errors on; - fastcgi_pass php; + #fastcgi_pass php:9000; } } \ No newline at end of file diff --git a/srcs/wordpress/index.php b/srcs/wordpress/index.php old mode 100644 new mode 100755