craftcms / docker

Craft CMS Docker images.
102 stars 38 forks source link

Nginx return 404 #48

Open ezawadzki opened 2 years ago

ezawadzki commented 2 years ago

Description

When I try to connect to localhost:8080, nginx is returning me a 404.

Here are some relevant docker-compose logs :

web_1       | 2021-09-21 14:56:53,943 INFO supervisord started with pid 1
web_1       | 2021-09-21 14:56:54,944 INFO spawned: 'nginx' with pid 8
web_1       | 2021-09-21 14:56:54,946 INFO spawned: 'php-fpm' with pid 9
web_1       | nginx: [alert] could not open error log file: open() "/var/lib/nginx/logs/error.log" failed (13: Permission denied)
web_1       | [21-Sep-2021 14:56:55] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
web_1       | [21-Sep-2021 14:56:55] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
web_1       | [21-Sep-2021 14:56:55] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
web_1       | [21-Sep-2021 14:56:55] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
web_1       | [21-Sep-2021 14:56:55] NOTICE: fpm is running, pid 9
web_1       | [21-Sep-2021 14:56:55] NOTICE: ready to handle connections
web_1       | 2021-09-21 14:56:56,012 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
web_1       | 2021-09-21 14:56:56,012 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
web_1       | 172.23.0.1 - - [21/Sep/2021:14:59:12 +0000] "GET / HTTP/1.1" 404 117 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0" "-" 0.000 - . -

Steps to reproduce

Just execute docker-compose up on suggested docker-compose.yml.

Additional info

Thanks for your help.

fangmarks commented 2 years ago

Why was this closed? I have the same issue currently, as well as postgres yelling at me that role "root" does not exist.

mikejdegroot commented 2 years ago

I have the same issue here too

leightonhughes commented 2 years ago

Also experiencing the same issue. Some further explanation to get up and running in the readme for docker newbies could be helpful as well.

timkelty commented 2 years ago

I'm still unable to reproduce this. To ensure we're all on the same page, can you clone this repo and follow the instructions in the README?

https://github.com/timkelty/craftcms-docker-compose

note: the role "root" does not exist. from postgres is a red herring.

mikejdegroot commented 2 years ago

I managed to get this up and running by initialising a craft installation as usual, then adding the docker-compose yaml and Dockerfile as suggested in this readme. The role "root" does not exist issue is solvable via adding the user to the pg_isready command as : test: pg_isready -U craftcms -d dev_craftcms

mikejdegroot commented 2 years ago

you will also need to exec into the shell once its up and running with docker-compose exec web sh and then run ./craft install to install craft to the db

timkelty commented 2 years ago

you will also need to exec into the shell once its up and running with docker-compose exec web sh and then run ./craft install to install craft to the db

Yes, or you can do it via the web interface (will prompt you on first visit to /admin)

timkelty commented 2 years ago

The role "root" does not exist issue is solvable via adding the user to the pg_isready command as : test: pg_isready -U craftcms -d dev_craftcms

Good call, I'll update the example compose file

wivaku commented 1 year ago

I'm also getting 404's. Maybe I am misunderstanding the instructions?

In new directory: using the docker-compose.yml from https://github.com/craftcms/docker#running-locally-with-docker-compose.
Tried image: craftcms/...:8.0 and image: craftcms/...:8.1.

I copied the .env.example (although I don't think it is used in the docker compose file), and I run docker compose up.

I get:

When I check the container, there's nothing in the /app folder (so: can't run ./craft install)

$ docker exec -it craftcms-web-1 sh

/app $ ls -l
total 0
craftcms-postgres-1  | 2023-05-01 11:28:34.307 UTC [1] LOG:  database system is ready to accept connections
craftcms-console-1   | Could not open input file: craft
craftcms-console-1 exited with code 1
craftcms-web-1       | 2023-05-01 11:29:04,098 INFO supervisord started with pid 1
craftcms-web-1       | 2023-05-01 11:29:05,107 INFO spawned: 'nginx' with pid 7
craftcms-web-1       | 2023-05-01 11:29:05,113 INFO spawned: 'php-fpm' with pid 8
craftcms-web-1       | nginx: [alert] could not open error log file: open() "/var/lib/nginx/logs/error.log" failed (13: Permission denied)
craftcms-web-1       | [01-May-2023 11:29:05] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
craftcms-web-1       | [01-May-2023 11:29:05] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
craftcms-web-1       | [01-May-2023 11:29:05] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
craftcms-web-1       | [01-May-2023 11:29:05] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
craftcms-web-1       | [01-May-2023 11:29:05] NOTICE: fpm is running, pid 8
craftcms-web-1       | [01-May-2023 11:29:05] NOTICE: ready to handle connections
craftcms-web-1       | 2023-05-01 11:29:06,253 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
craftcms-web-1       | 2023-05-01 11:29:06,253 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

craftcms-web-1       | 172.24.0.1 - - [01/May/2023:11:29:14 +0000] "GET /admin HTTP/1.1" 404 178 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36" "-" 0.000 - . -
craftcms-web-1       | 172.24.0.1 - - [01/May/2023:11:29:20 +0000] "GET / HTTP/1.1" 404 178 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36" "-" 0.000 - . -
timkelty commented 1 year ago

@wivaku These docker images only provide the environment required to run Craft, not any of the actual application files.

If you don't have an existing Craft app, you can start one via composer create-project craftcms/craft my-project.

There more in-depth guides here, but those focus on using DDEV for local development.

wivaku commented 1 year ago

ah, ok. Thanks.

nagarjuna-jammula commented 6 months ago

Hi, I have created a local project and was able to build a image with dependencies. But when i use this image to run container on ECS, the dependent files are missing and it gives me 404 error. Anyone able to run craftcms on ECS?

timkelty commented 6 months ago

@nagarjuna-jammula Hmmm, yes we run them on ECS regularly… if you can share more details, or send to support@craftcms.com, we may be able to point you in the right direction.