YOURLS / containers

📦 Container Images for YOURLS
https://yourls.org
MIT License
134 stars 42 forks source link

Error: Cannot serve directory /var/www/html/ #20

Closed CloudDevOps-Engineer closed 5 years ago

CloudDevOps-Engineer commented 5 years ago

Hi All,

While deploying the latest YOURLS image. We are getting below error.

root@sahilhans-VirtualBox:~# docker logs 703491dc3020d62b0363f9b056a930e2b4cf1911e7cd1325b844c0b9469ad215
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Fri Feb 01 16:29:27.922061 2019] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.2.14 configured -- resuming normal operations
[Fri Feb 01 16:29:27.924843 2019] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
**[Fri Feb 01 16:32:41.716464 2019] [autoindex:error] [pid 31] [client 127.0.0.1:60106] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.php,index.html) found, and server-generated directory index forbidden by Options directive**
127.0.0.1 - - [01/Feb/2019:16:32:56 +0000] "GET / HTTP/1.1" 403 501 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0"
127.0.0.1 - - [01/Feb/2019:16:32:56 +0000] "GET /favicon.ico HTTP/1.1" 200 302 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0"

I am struggling on this from last two days.. Still no luck. Any help is much appreciated. TIA

LeoColomb commented 5 years ago

Thanks for this report, @CloudDevOps-Engineer! Could you please list files in /var/www/html/ (running ls -sal /var/www/html/)? What is the exact image do you use? Did you mount a volume?

LeoColomb commented 5 years ago

And also did you try to install YOURLS by accessing http://docker-ip/admin/?

CloudDevOps-Engineer commented 5 years ago

Hi Leo,

Here are the required details - Output for ls -sal root@sahilhans-VirtualBox:~/test# ls -sla /var/www/html total 160 4 drwxrwxr-x 9 www-data www-data 4096 Dec 18 12:46 . 4 drwxr-xr-x 3 root root 4096 Feb 2 15:51 .. 4 drwxrwxr-x 2 www-data www-data 4096 Feb 2 16:21 admin 4 -rw-rw-r-- 1 www-data www-data 1050 Dec 18 12:46 composer.json 20 -rw-rw-r-- 1 www-data www-data 20102 Dec 18 12:46 composer.lock 4 drwxrwxr-x 2 www-data www-data 4096 Dec 18 12:46 css 4 -rw-rw-r-- 1 www-data www-data 263 Dec 18 12:46 .editorconfig 4 drwxrwxr-x 2 www-data www-data 4096 Dec 18 12:46 images 4 drwxrwxr-x 8 www-data www-data 4096 Dec 18 12:46 includes 4 drwxrwxr-x 2 www-data www-data 4096 Dec 18 12:46 js 4 -rw-rw-r-- 1 www-data www-data 1089 Dec 18 12:46 LICENSE 4 drwxrwxr-x 2 www-data www-data 4096 Feb 2 16:17 pages 40 -rw-rw-r-- 1 www-data www-data 40019 Dec 18 12:46 readme.html 4 -rw-rw-r-- 1 www-data www-data 356 Dec 18 12:46 sample-public-api.txt 8 -rw-rw-r-- 1 www-data www-data 5391 Dec 18 12:46 sample-public-front-page.txt 4 -rw-rw-r-- 1 www-data www-data 1547 Dec 18 12:46 sample-remote-api-call.txt 4 -rw-rw-r-- 1 www-data www-data 132 Dec 18 12:46 sample-robots.txt 4 drwxrwxr-x 4 www-data www-data 4096 Feb 2 16:18 user 4 -rw-rw-r-- 1 www-data www-data 1534 Dec 18 12:46 yourls-api.php 4 -rw-rw-r-- 1 www-data www-data 1043 Dec 18 12:46 yourls-go.php 20 -rw-rw-r-- 1 www-data www-data 20354 Dec 18 12:46 yourls-infos.php 4 -rw-rw-r-- 1 www-data www-data 2417 Dec 18 12:46 yourls-loader.php

I have used the latest image using : docker pull yourls

Yes I have mounted the volume. One quick question.. Can I mount it on /var/www/html..? (Though I have used some different path)

Not able to access http://docker-ip/admin/.

Let me know if you need any other information . Thanks

LeoColomb commented 5 years ago

Thanks for this additional information, @CloudDevOps-Engineer.

Please avoid sending email directly or mentioning previous contributors to request exclusive attention, this is definitely not a productive way of improving FOSS.

Not able to access http://docker-ip/admin.

You sure remplace docker-ip by your effective docker ip, right? The admin folder exists, it must works with at very least a redirection.

Yes I have mounted the volume.

Please re-check your docker config, this seems more a server config issue than a real YOURLS and/or YOURLS image issue.

LeoColomb commented 5 years ago

I'm closing for no-response, and because I suspect a local Docker config issue. Feel free to continue the discussion below.

crypticviper commented 2 years ago

Edit: It all made sense after reading below thred.

https://github.com/YOURLS/YOURLS/issues/2549#issuecomment-587484313


I have a similar issue. "http://docker-ip/admin" works fine but the base URL just gives a forbidden with same error message as OP. Any additional configuration to be done here?

Below is my docker-compose file

version: '3.1'

services:

  yourls:
    image: yourls
    restart: always
    ports:
      - 9400:80
    environment:
      YOURLS_DB_HOST: db
      YOURLS_DB_USER: user
      YOURLS_DB_PASS: mypassword
      YOURLS_DB_NAME: yourls
      YOURLS_SITE: https://tiny.example.net
      YOURLS_USER: yourlsuser
      YOURLS_PASS: myyourlspassword
    volumes:
      - myvolume:/var/www/html/

  db:
    image: yobasystems/alpine-mariadb:latest  # running on rpi hence this image
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: myrootpassword
      MYSQL_DATABASE: yourls
      MYSQL_USER: user
      MYSQL_PASSWORD: mypassword
    volumes:
      - mydbvolume:/var/lib/mysql
ooii commented 2 years ago

Hi, I'm having this error since few days (actually, since the last time I used yourls). But I can't figure out how it could happen. It's running in a container and is behind an nginx reverse proxy, which both configurations did not change since the last time it worked.