Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Apache2 failed to start

  1. #11
    Join Date
    Jul 2021
    Beans
    16

    Re: Apache2 failed to start

    I think I was having hardware problems. The ethernet connection was intermittent and there was a lot of disc noise. I decided to start again with a new hdd and a quick re-tinning of the ethernet socket and adjacent SM chips on the MB. I then installed Lubuntu to an empty disc, then installed samba and apache2 after an update and upgrade. All is now working except:

    I wanted to follow what I thought was the convention that, as I download new rides (usually on my W10 PC), I would write them to a Fulgaz folder in my home folder on the laptop. (That's where the samba share was set up and working).


    I tried renaming the var/www/html folder to html.old and pointed a new html shortcut/folder to my home/fulgaz folder (which has all the ride mp4s in it). Should have worked to my mind - it didn't. I got 403 Forbidden on both machine browsers. I changed ownership and group of the html link folder back and forth from user to root, but it made no difference.

    Does Apache not like links? What the rule here?

  2. #12
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    15,632
    Distro
    Kubuntu Development Release

    Re: Apache2 failed to start

    Often symlinks are disabled unless you specify "FollowSymLinks" like this:
    Code:
    <VirtualHost *:80>
    [stuff]
    <Directory "/var/www/html">
         Option FollowSymLinks
    <Directory>
    [stuff]
    </VirtualHost>
    You can also make this change by putting a file called .htaccess in the /var/www/html directory with simply the line
    Code:
    FollowSymLinks
    Last edited by SeijiSensei; 4 Weeks Ago at 05:18 PM.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  3. #13
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Apache2 failed to start

    Linking to files in a HOME directory is generally a bad idea for apache. There is another method designed for exactly this purpose - the public_html option in apache. Look that up and use it instead.

    BTW, samba shares from a HOME that aren't using the very specific [Homes] samba config section are a bad idea. In the last few weeks, we had a guy in these forums will all sorts of issues because he'd decided to share a directory from his HOME using some GUI config tool. Bad idea. For everything Samba, configure the server using the /etc/samba/smb.conf file - unless you seek future problems.
    Code:
    [homes]
      comment = Home Directories
      hosts allow =  172.22.22.0/24  
      hosts deny = 0.0.0.0/0
      browseable = yes
      guest ok = no
      writable = yes
      create mask = 0644
      directory mask = 0755
      valid users = %S
    is a valid stanza for allowing each user to connect to their HOME directory using samba from other systems. Add that to the bottom of the
    /etc/samba/smb.conf and restart the daemon. Probably need to change the IP address subnet for your network. Easy.

    For apache ... https://httpd.apache.org/docs/2.4/ho...blic_html.html Just make the files readable by the apache user ... www-data ... I think. That would probably mean making whatever directory you choose to have the file inside have 755 permissions and the files would need 644 permissions. However, you should be aware that "streaming" mp4 files isn't as easy as making them available on a web server. There are specific "streaming" servers ... which know how to let clients move forward and backwards and limit how much data they send to be network-nice. But it might be fine for your needs. Won't know until you try.

  4. #14
    Join Date
    Jul 2021
    Beans
    16

    Re: Apache2 failed to start

    SeijiSensei, I'm sure the FollowSymLinks statement is there and enabled but I will check again. I think it was in /etc/apache2/sites-enabled/000-default.conf if I have I remembered correctly...
    There are so many ways and so many locations for configuration settings and I'm easily confused...

    TheFu, I've got a lot of reading to do before I understand your warnings and advice. However, it all does seem a bit OTT, considering I will be the only user and the system is only powered up for maybe two or three 90 minute bike trainer sessions a week.

    p.s I found this https://priyankacool10.wordpress.com...ww-in-apache2/

    which seems to be relevant. Is this the way to go?
    Last edited by fausto99; 4 Weeks Ago at 03:18 PM.

  5. #15
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Apache2 failed to start

    Quote Originally Posted by fausto99 View Post
    TheFu, I've got a lot of reading to do before I understand your warnings and advice. However, it all does seem a bit OTT, considering I will be the only user and the system is only powered up for maybe two or three 90 minute bike trainer sessions a week.
    Apache should be managing files in /var/.... it is a permissions, owner and group thing.
    Users should manage files in their HOME directories. Also an owner and permissions thing.
    Doing something else, is a bad idea and there will be problems in the future if you ignore this, especially as someone new.

    Apache has a built-in method to allow all users to have websites, with files from their HOME directories. It was 1 line, in 1 config file, last time I used it. Heck, I think I have it here for an internal-only website.

    To enable it is 2 commands:
    Code:
    sudo a2enmod userdir
    sudo systemctl restart apache2
    Now the URL http://example.com/~thefu/file.html will be translated to the file path /home/thefu/public_html/file.html
    Simple and better for you since you'll be managing files in your ~/public_html/ directory as a normal user. Just ensure that the permissions allow "other" read access to the directory and files.

  6. #16
    Join Date
    Jul 2021
    Beans
    16

    Re: Apache2 failed to start

    Quote Originally Posted by TheFu View Post
    Apache should be managing files in /var/.... it is a permissions, owner and group thing.
    Users should manage files in their HOME directories. Also an owner and permissions thing.
    ...
    Now the URL http://example.com/~thefu/file.html will be translated to the file path /home/thefu/public_html/file.html
    Simple and better for you since you'll be managing files in your ~/public_html/ directory as a normal user. Just ensure that the permissions allow "other" read access to the directory and files.
    Ok, thanks. Will have another look on the spare system when I get a mo. Have been doing far too much sys admin and not enough riding lately

  7. #17
    Join Date
    Jul 2021
    Beans
    16

    Re: Apache2 failed to start

    Quote Originally Posted by TheFu View Post
    Apache has a built-in method to allow all users to have websites, with files from their HOME directories. It was 1 line, in 1 config file, last time I used it. Heck, I think I have it here for an internal-only website.

    To enable it is 2 commands:
    Code:
    sudo a2enmod userdir
    sudo systemctl restart apache2
    Now the URL http://example.com/~thefu/file.html will be translated to the file path /home/thefu/public_html/file.html
    Simple and better for you since you'll be managing files in your ~/public_html/ directory as a normal user. Just ensure that the permissions allow "other" read access to the directory and files.
    I've uninstalled and re-installed apache, then mv all my mp4 files into /home/userdir/public_html

    Now, running "sudo a2enmod userdir" gives ERROR: Module /home/userdir does not exist

    How have I mis-interpreted your post? What is a module in this context?
    Last edited by fausto99; 3 Weeks Ago at 08:51 AM. Reason: punctuation

  8. #18
    Join Date
    Jul 2021
    Beans
    16

    Re: Apache2 failed to start

    Bump

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •