Page 1 of 4 123 ... LastLast
Results 1 to 10 of 39

Thread: Apache on Ubuntu - Help with simple settings please

  1. #1
    Join Date
    Dec 2013
    Beans
    69

    Apache on Ubuntu - Help with simple settings please

    I have switched from WAMP on WinXP to LAMP on ubuntu 12.04 LTS but can't get it to work properly. I have an external hdd connected to my server (Lenovo S10e) with all my media on, and these mediafiles are linked from my website which is hosted on weebly.com. I have no html, php or other files on the server. I need to set it up as it was on WinXP so that I don't have to edit thousands of links on my website. I need to know:

    - Which file do I edit to specify the ext hdd as the root of the server (instead of the www dir) (Using Apache 2.2.22).
    - How do I denote this path? The name of the hdd is simply M for media. Is the path then /media/M/ ?
    - Do I need to configure a firewall on the server? How?

    I have only been using ubuntu two days so I'd rather stay away from the terminal and unnecessary complications that I don't understand. I am learning through the Getting started with ubuntu manual, but I need the server up and running ASAP.

    Thanks for helping a noob out.

  2. #2
    Join Date
    Jan 2006
    Location
    Not heaven... Iowa
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Apache on Ubuntu - Help with simple settings please

    Thread began here.
    Additional information available there.
    Linux User #415691 Ubuntu User #8629
    Iowa Team (LoCo): [Wiki] [Launchpad]
    IRC channel: #ubuntu-us-ia on irc.freenode.net

  3. #3
    Join Date
    Dec 2013
    Beans
    69

    Re: Apache on Ubuntu - Help with simple settings please

    Ok, I have now figured out and done the following:

    - The httpd.conf is not used at all on Ubuntu. It's there, as someone put it, "for historical reasons" (to confuse newbies). Anyway it is blank.
    - I have set the apache2.conf file to /etc/apache2 which is the install path.
    - I have edited the root directory in the default-file in /sites-available/ and set it to "/media/M" without a slash at the end.
    - When testing a link from my site to a pdf-document on the server, I get a 403:Forbidden error. Guessing I need to open port 80, 8080 and 21 on the server...
    - Downloaded and added the ports in the app "Firewall configuration", but this still gets me a 403:Forbidden error.
    - Oh, and I haven't changed anything in the router (i.e port forwarding) since this should stay the same.
    - Tried to find help from the apache community but they use IRC that I have never used and is another nightmare to setup on an OS I hardly know.

    This is now the third day of pulling my hair out over this, so I tried to revert back to WinXP, but for some reason WAMP doesn't work anymore. So now the site is offline and I don't know what to do...
    Last edited by p.callan; December 7th, 2013 at 02:59 PM.

  4. #4
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Apache on Ubuntu - Help with simple settings please

    If you're getting a "403" error then you are getting through to the server but maybe index.html is missing or the directory+file is not readable by the web server.

    By the way:

    The default for Apache2 on Ubuntu is to come with one pre-configured virtual host. You can find the settings for that virtual host in /etc/apache2/sites-enabled/000-default.conf /etc/apache2/sites-enabled/000-default If you have to make any changes do it to that file only, also you need to restart the web server (not your whole box) like this for the changes to take effect:

    Code:
    sudo service apache2 restart
    The default place for your web pages in that first vhost is /var/www You'll need to have index.html there, if nothing else. If you're the only user on that machine then you can get write access by taking ownership of the web directory.

    Code:
    sudo chown -R p.callan /var/www
    If you are sharing with other users on the same machine who need access, then you can use group permissions instead.

    If you want to check the configuration file for correct syntax, then you can do it this way:

    Code:
    apache2ctl configtest
    Last edited by Lars Noodén; December 7th, 2013 at 03:49 PM. Reason: wrong file name

  5. #5
    Join Date
    Apr 2012
    Beans
    6,966

    Re: Apache on Ubuntu - Help with simple settings please

    This is NOT my area of expertise but I set up a 'play' server some time ago with default document root /data/mysite. As far as I recall the steps were


    1. edit the /etc/apache2/sites-available/default file (NOT the sites-enabled file), changing the path in TWO places

    Code:
    $ head -15 /etc/apache2/sites-available/default
    <VirtualHost *:80>
        ServerAdmin webmaster@localhost
    
        DocumentRoot /data/mysite
        <Directory />
            Options FollowSymLinks
            AllowOverride None
        </Directory>
        <Directory /data/mysite>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
        </Directory>
    2. run a2ensite (available-to-enabled) to create the appropriate symlink in /etc/apache2/sites-enabled

    I don't recall having to do anything with the apache2.conf file. Once you restart the apache2 service, test it on the localhost interface to rule out any issues about ports / firewalls - if you don't have a browser on the localhost (e.g. if it is a non-GUI server) you can use wget

    Code:
    $ sudo service apache2 restart
     ... waiting  * Restarting web server apache2                           [ OK ] 
    $ 
    $ wget -O- http://localhost | html2text

  6. #6
    Join Date
    Dec 2013
    Beans
    69

    Re: Apache on Ubuntu - Help with simple settings please

    Ok, thanks for the reply.
    I did the following

    sudo -s
    nano /etc/apache2/sites-enabled/000-default.conf


    But the file is blank. I'm very shaky on using the terminal, I don't speak the language so to speak =)
    Also, I have no html-files on the server. It is only used for media files. But there are 2 autogenerated files in /var/www/, index.html and testphp.php.
    Are the other paths that I mentioned above correct now? I should have written them down on paper before I changed them...

    "If you're the only user on that machine then you can get write access by taking ownership of the web directory."
    I am the only user, but I don't understand what you mean by ownership or syntax. I just need to change the /var/www/ to my hdd path... At least that's what I did on the Windows version.

    Thanks for helping me!

  7. #7
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Apache on Ubuntu - Help with simple settings please

    That configuration file should not be empty. Something is not quite right. Can you check the contents of the sites-enabled directory?

    Code:
    $ ls -lh /etc/apache2/sites-enabled/
    total 0
    lrwxrwxrwx 1 root root 26 Dec  7 16:39 000-default -> ../sites-available/default
    It should look like the above with the symlink that steeldriver mentioned. If the directory is empty or the file 000-default does not exist, then enable the site:

    Code:
    sudo a2ensite default
    If the file exists but is not a symlink, then it has to be moved out of the way before enabling the site. The -> indicates that it is a symlink or not.

  8. #8
    Join Date
    Dec 2013
    Beans
    69

    Re: Apache on Ubuntu - Help with simple settings please

    Steeldriver: Thanks so much for your reply.

    "edit the /etc/apache2/sites-available/default file (NOT the sites-enabled file), changing the path in TWO places"
    Ok, they are now set to /media/M
    (The drive letter in WinXP is D, does this matter in ubuntu? The name I've given it is M, however)

    "2. run a2ensite (available-to-enabled) to create the appropriate symlink in /etc/apache2/sites-enabled"
    Ok, but how do I do that exactly? Just type a2ensite in the terminal?

    Localhost in the browser gives the same 403:Forbidden message...

  9. #9
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Apache on Ubuntu - Help with simple settings please

    If /etc/apache2/sites-available/default is set up correctly, then you would just run a2ensite in the terminal. If you specify a site (e.g. default) then it will load that one. If not you get to choose from the ones available.

    What do you have for DocumentRoot in the /etc/apache2/sites-available/default file?

  10. #10
    Join Date
    Dec 2013
    Beans
    69

    Re: Apache on Ubuntu - Help with simple settings please

    Ok this is confusing. The 000-default.conf is blank when I open it in nano through the terminal but not when I doubleclick on the icon.

    DocumentRoot in sites-available is /media/M as well as <Directory /media/M>
    DocumentRoot in sites-enabled is /media/M as well as <Directory /media/M>

    When I type
    $ ls -lh /etc/apache2/sites-enabled/

    it says command not found.
    edit: sorry, I wrote the dollarsign too. It says:
    total 0
    lrwxrwrwx 1 root root 26 dec 6 00:24 <cyan>000-default</cyan> -> --/sites-available/default

    (tags added)
    Last edited by p.callan; December 7th, 2013 at 04:07 PM.

Page 1 of 4 123 ... LastLast

Tags for this Thread

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
  •