Announcement

Collapse
No announcement yet.

Apache server hell - help!

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Apache server hell - help!

    [Sigh] I hate to ask for help here but I know somebody has the answer and I've invested hours in this problem.

    I've set up my apache2 server and have had it working without issue but I wanted to change the location of the document root for it because its in the root user location and I'm having trouble ftp'ing data into that folder. I also know that it isn't appropriate to use the root user for the web location. The apache2 install is in /etc/apache2

    So, I've changed my apache2 http.conf to read the following:

    Code:
    Servername localhost1
    AddHandler application/x-httpd-php .php
    AddHandler application/x-httpd-php-source .phps
    DocumentRoot /mysite
    Unfortunately, I get a 403 error "Forbidden - you don't have permission to access / on this server."

    I've tried other locations for the folder and restarted the server using the apache2ctl restart command each time. I know it reads the file because if I put an invalid path in the DocumentRoot it will tell me so.

    I've also added /mysite to my sites-enabled folder and included Order allow,deny and Allow from all in both the default file and the mysite file. The mysite file reads as follows:

    Code:
    <VirtualHost *:80>
            ServerAdmin [email protected]
    
            DocumentRoot /mysite
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
                    Order allow,deny
                    Allow from all
            </Directory>
            <Directory /mysite>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
    
            ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
            <Directory "/usr/lib/cgi-bin">
                    AllowOverride None
                    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                    Order allow,deny
                    Allow from all
            </Directory>
    
            ErrorLog /var/log/apache2/errormysite.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
    
            CustomLog /var/log/apache2/accessmysite.log combined
    
        Alias /doc/ "/usr/share/doc/"
        <Directory "/usr/share/doc/">
            Options Indexes MultiViews FollowSymLinks
            AllowOverride None
            Order deny,allow
            Allow from all
            Allow from 127.0.0.0/255.0.0.0 ::1/128
        </Directory>
                    
    </VirtualHost>
    At this point, I've tried to set everything back to the original working setup but at this point I am denied access for all options. I know I have a permission problem but I can't figure it out.

    Can anyone suggest a fix? Thanks in advance.
    Originally posted by ghettocruzer
    I was gung ho on building a PC [until] just recently. However, between my new phone having internet and GPS and all...and this kit...Im starting to have trouble justfiying it haha.
    Want to:
    -Find out about the new iBug iPad install?
    -Find out about carPC's in just 5 minutes? View the Car PC 101 video

  • #2
    whan you created the /mysite dir, did you chmod/chown the folder to allow access to apache, etc?
    i.e.
    Code:
    chmod 755 /mysite
    etc..
    MacMini in an Alfa? - Why not!

    Comment


    • #3
      I thought I did. Just tried it again and no luck.

      Error log:

      Code:
      [Sun Nov 15 01:05:28 2009] [error] [client 192.168.1.5] (13)Permission denied: access to / denied
      [Sun Nov 15 01:05:28 2009] [error] [client 192.168.1.5] (13)Permission denied: access to /favicon.ico denied, referer: http://192.168.1.4/
      Originally posted by ghettocruzer
      I was gung ho on building a PC [until] just recently. However, between my new phone having internet and GPS and all...and this kit...Im starting to have trouble justfiying it haha.
      Want to:
      -Find out about the new iBug iPad install?
      -Find out about carPC's in just 5 minutes? View the Car PC 101 video

      Comment


      • #4
        can you access it from 127.0.0.1?
        MacMini in an Alfa? - Why not!

        Comment


        • #5
          this is from mine:
          Code:
          ...
          
          Listen 80
          
          ...
          Alias /alfa "/store/Car Disc"
          
          <Directory "/store/Car Disc">
              Options Indexes FollowSymLinks Multiviews
              AllowOverride None
              Order allow,deny
              Allow from all
          </Directory>
          and from ls

          drwxr-xr-x 13 nobody nobody 4096 Nov 5 23:29 Car Disc
          MacMini in an Alfa? - Why not!

          Comment


          • #6
            just looked at your config up there, is the caps on "Allow from all" important?
            MacMini in an Alfa? - Why not!

            Comment


            • #7
              Okay! Progress!! Looking inside my 000-default file and the mysite file in the sites-enabled folder, I decided to trim down the various entries in it to just focus on my single folder. I had been hesitant to do this because I thought I might break something. But then I figured it was broken already so...

              Turns out it is using the 000-default file for access. I removed the mysite file and changed the 000-default file to the following:

              Code:
              <VirtualHost *:80>
                      ServerAdmin [email protected]
              
                      DocumentRoot /mysite
                      <Directory /mysite>>
                              Options Indexes FollowSymLinks Multiviews
                              AllowOverride None
                              Order Allow,Deny
                              Allow from all
                      </Directory>
              
                      ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
              
                      ErrorLog /var/log/apache2/error.log
              
                      # Possible values include: debug, info, notice, warn, error, crit,
                      # alert, emerg.
                      LogLevel warn
              
                      CustomLog /var/log/apache2/access.log combined
              
              
              </VirtualHost>

              I can now view the default index.html file. However, when I ftp any other file (such as 'test.html') into the /mysite directory and try to view it, I get the 403 error. I ran a chown 755 /mysite on the folder but it didn't help.

              Also, I tried editing the 000-default file so it pointed at a folder under user /home/bugbyte/var/www but got the 403 error.

              I appear to be missing the .htaccess file. Here's the log output:

              Code:
              [Mon Nov 16 15:29:13 2009] [crit] [client 192.168.1.11] (13)Permission denied: /home/bugbyte/var/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
              [Mon Nov 16 15:29:13 2009] [crit] [client 192.168.1.11] (13)Permission denied: /home/bugbyte/var/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable, referer: http://192.168.1.4/
              [Mon Nov 16 15:29:48 2009] [crit] [client 192.168.1.11] (13)Permission denied: /home/bugbyte/var/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
              [Mon Nov 16 15:29:48 2009] [crit] [client 192.168.1.11] (13)Permission denied: /home/bugbyte/var/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable, referer: http://192.168.1.4/
              [Mon Nov 16 15:31:57 2009] [notice] SIGHUP received.  Attempting to restart
              [Mon Nov 16 15:31:58 2009] [notice] Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4 with Suhosin-Patch configured -- resuming normal operations
              [Mon Nov 16 15:32:01 2009] [error] [client 192.168.1.11] File does not exist: /mysite/favicon.ico, referer: http://192.168.1.4/
              [Mon Nov 16 15:34:05 2009] [error] [client 192.168.1.11] (13)Permission denied: file permissions deny server access: /mysite/test.html
              You can see where I tried to use /home/bugbyte/var and it failed to find a .htaccess file. After doing some reading, it isn't supposed to check for a .htaccess file if you have AllowOverride set to None.

              You can also see where I changed it back to /mysite and tried to access the test.html file and got file permissions denied.

              So, summary is that I can now read the index.html file in /mysite by typing: http://192.168.1.4 but can't read any other files when I type: http://192.168.1.4/test.html. Getting closer, but any suggestions are again greatly appreciated!
              Originally posted by ghettocruzer
              I was gung ho on building a PC [until] just recently. However, between my new phone having internet and GPS and all...and this kit...Im starting to have trouble justfiying it haha.
              Want to:
              -Find out about the new iBug iPad install?
              -Find out about carPC's in just 5 minutes? View the Car PC 101 video

              Comment


              • #8
                Whenever I restart Apache I use "sudo etc/init.d/apache2 restart" and it restarts the service. You're running Ubuntu on that Sheeva plug right? And this is what you're configuring? You could always reinstall Apache, it takes 2 minutes.
                Ampie Case
                2.5" Hard Drive 80GB Samsung 5400RPM
                256 MB DDR2 PC5400
                Xenarc 700TSV - VGA Monitor
                Intel D945GCLF Motherboard
                M2-ATX-HV

                2005 Honda Civic

                Comment


                • #9
                  Try this basic .htaccess file...

                  Code:
                  RewriteEngine On RewriteCond %{HTTP_HOST} localhost$ [NC] RewriteRule ^.*$ http://localhost%{REQUEST_URI} [R=permanent,L] ErrorDocument 400 / ErrorDocument 401 / ErrorDocument 403 / ErrorDocument 404 / ErrorDocument 500 /

                  Comment


                  • #10
                    Okay, success again! I reinstalled Apache2 but had the same issue. However, a little more searching and I found that chmod rather than chown was the right entry. Here's the exact entry that fixed the permissions:

                    chmod -R 755 /mysite

                    Its working right now, so I'm a little hesitant to go change it to /home/bugbyte/var/www! This is just a temporary test anyhow, so I think I'll leave well enough alone and actually accomplish something for a change.

                    Thanks for your help pulsarsimon and Maheriano!
                    Originally posted by ghettocruzer
                    I was gung ho on building a PC [until] just recently. However, between my new phone having internet and GPS and all...and this kit...Im starting to have trouble justfiying it haha.
                    Want to:
                    -Find out about the new iBug iPad install?
                    -Find out about carPC's in just 5 minutes? View the Car PC 101 video

                    Comment


                    • #11
                      [Mon Nov 16 15:34:05 2009] [error] [client 192.168.1.11] (13)Permission denied: file permissions deny server access: /mysite/test.html
                      This is what leads me to believe it's a simple file permissions issue. Can you run a ls -l on /mysite and paste the output?

                      My guess is that a simple chmod -R a+r /mysite should do the trick.

                      EDIT:
                      Ooops, i guess i was a few seconds too late :P
                      Former author of LinuxICE, nghost, nobdy.
                      Current author of Automotive Message Broker (AMB).
                      Works on Tizen IVI. Does not represent anyone or anything but himself.

                      Comment


                      • #12
                        Ah! I've also found out that vsftpd, my ftp service, automagically mangles the file permissions on upload. You have to change umask settings in the vstpd.conf file to fix this.

                        Kind of sucks!
                        Originally posted by ghettocruzer
                        I was gung ho on building a PC [until] just recently. However, between my new phone having internet and GPS and all...and this kit...Im starting to have trouble justfiying it haha.
                        Want to:
                        -Find out about the new iBug iPad install?
                        -Find out about carPC's in just 5 minutes? View the Car PC 101 video

                        Comment


                        • #13
                          Ah! I've also found out that vsftpd, my ftp service, automagically mangles the file permissions on upload. You have to change umask settings in the vstpd.conf file to fix this.
                          Stop using ftp! SCP [or sftp - uses the same transport] is much more secure, easier to use, more reliable, easier to get through firewalls, more secure, easier to control permissions with, more secure...

                          On windows, winscp is your friend.

                          Perhaps it's outside the particular scope of this exercise, but the cool kids put their websites into version control and then on the web server to pull updates [rather than trying to push them using ftp]

                          Gary (-;
                          OBDGPSLogger, for logging OBDII and/or GPS data
                          OBDSim, an OBDII/ELM327 software simulator
                          mp3car forums: obdgpslogger, obdsim

                          Comment


                          • #14
                            The particular problem I'm trying to solve is for a piece of software that sends weather data gathered from a weather station via ftp to a location that is used when the server builds the page. The weather data software is programmed to use ftp.

                            If I install winscp and the software tries to use ftp, is it using winscp or does it still use ftp?
                            Originally posted by ghettocruzer
                            I was gung ho on building a PC [until] just recently. However, between my new phone having internet and GPS and all...and this kit...Im starting to have trouble justfiying it haha.
                            Want to:
                            -Find out about the new iBug iPad install?
                            -Find out about carPC's in just 5 minutes? View the Car PC 101 video

                            Comment


                            • #15
                              ewww. No, that's definitely ftp.

                              Does the weather software run on a different machine? Perhaps you could set up a little localhost-only ftp server, and scp the data up? If you want it automated, you can set up public keys and use command-line scp instead of winscp. That way you never expose the ftp server outside of localhost.

                              Overall... what's the actual weather software, and whree are you running it?

                              Gary (-;
                              OBDGPSLogger, for logging OBDII and/or GPS data
                              OBDSim, an OBDII/ELM327 software simulator
                              mp3car forums: obdgpslogger, obdsim

                              Comment

                              Working...
                              X