grezmel
Posts: 7
Joined: Sun Jan 03, 2016 8:39 pm

Error 403 Forbidden - Webserver

Sun Jan 03, 2016 8:47 pm

Hi All,

1st post, so hello everyone :)

ive run into a bit of a problem, for some reason my website hosted on my pi has started displaying Error 403 Forbidden when external user try and access the site. I can access it via the URL from home without any issues.

It worked fine previously (I havent changed anything).

the URL is www.grahammelbournephotography.com and im also using no-ip.com to direct etc.

Any ideas ?

thanks in advance

SonOfAMotherlessGoat
Posts: 690
Joined: Tue Jun 16, 2015 6:01 am

Re: Error 403 Forbidden - Webserver

Mon Jan 04, 2016 5:34 am

Do you intend for the website to redirect to the /UI directory instead of loading an index.html?
Account Inactive

grezmel
Posts: 7
Joined: Sun Jan 03, 2016 8:39 pm

Re: Error 403 Forbidden - Webserver

Mon Jan 04, 2016 8:10 am

Hmm not sure why it would be redirecting to the /UI directory as I hadn't changed anything. Please can you point me in the right direction as to where to change this as it works fine when I access the index.html from the same network.......

User avatar
Laurens-wuyts
Posts: 716
Joined: Wed Aug 21, 2013 7:35 pm
Location: Belgium
Contact: Website

Re: Error 403 Forbidden - Webserver

Mon Jan 04, 2016 9:01 am

Are you sure the internal IP address of your raspberry pi isn't changed?

Laurens

grezmel
Posts: 7
Joined: Sun Jan 03, 2016 8:39 pm

Re: Error 403 Forbidden - Webserver

Mon Jan 04, 2016 9:16 am

Hi, I access the raspberry using the same ip as always.

User avatar
DougieLawson
Posts: 39124
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Error 403 Forbidden - Webserver

Mon Jan 04, 2016 11:23 am

I'd start by looking at your router. Is the port forwarding done right?

This is what your system sent to me

Code: Select all

root@aplus /tmp # wget --server-response http://www.grahammelbournephotography.com/
--2016-01-04 11:16:24--  http://www.grahammelbournephotography.com/
Resolving www.grahammelbournephotography.com (www.grahammelbournephotography.com)... 2.127.21.102
Connecting to www.grahammelbournephotography.com (www.grahammelbournephotography.com)|2.127.21.102|:80... connected.
HTTP request sent, awaiting response...
  HTTP/1.1 200 OK
  Date: Mon, 04 Jan 2016 11:16:29 GMT
  Server: Apache
  Last-Modified: Tue, 13 Oct 2015 17:27:21 GMT
  ETag: "e1-521ffc222f040"
  Accept-Ranges: bytes
  Content-Length: 225
  Vary: Accept-Encoding
  Keep-Alive: timeout=15, max=100
  Connection: Keep-Alive
  Content-Type: text/html
  Content-Language: en
Length: 225 [text/html]
Saving to: ‘index.html’

index.html          100%[=====================>]     225  --.-KB/s   in 0s

2016-01-04 11:16:24 (2.59 MB/s) - ‘index.html’ saved [225/225]
Can you run wget --server-response http://pi.local on your system because I suspect that page is being served by your router.
Can you take a look in your /var/log/apache2/* logs there should be a hit from "80.xx9.xx2.243" if my request got through to your raspberry pi. Something like

Code: Select all

www.grahammelbournephotography.com:80 80.xx9.xx2.243 - - [04/Jan/2016:11:20:45 +0000] "GET / HTTP/1.1" 200 1151 "-" "Wget/1.16 (linux-gnueabihf)"
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

grezmel
Posts: 7
Joined: Sun Jan 03, 2016 8:39 pm

Re: Error 403 Forbidden - Webserver

Mon Jan 04, 2016 12:00 pm

Thanks for your reply - there is no record for .243 in my log file and running wget --server-response http://pi.local I get the following:
Resolving pi.local (pi.local)... failed: Name or service not known.
wget: unable to resolve host address `pi.local'

User avatar
DougieLawson
Posts: 39124
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Error 403 Forbidden - Webserver

Mon Jan 04, 2016 1:01 pm

By pi.local I meant whatever your LAN IP address is for your RPi. I run the avahi-daemon so can use http://pi.local
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

grezmel
Posts: 7
Joined: Sun Jan 03, 2016 8:39 pm

Re: Error 403 Forbidden - Webserver

Mon Jan 04, 2016 1:24 pm

thanks for your help :

Connecting to 192.168.0.19:80... connected.
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Date: Mon, 04 Jan 2016 13:24:01 GMT
Server: Apache/2.2.22 (Debian)
Last-Modified: Mon, 13 Jul 2015 18:23:28 GMT
ETag: "476b3-2dac-51ac5d16f0a45"
Accept-Ranges: bytes
Content-Length: 11692
Vary: Accept-Encoding
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html
Length: 11692 (11K) [text/html]
Saving to: `index.html'

100%[======================================>] 11,692 --.-K/s in 0.001s

2016-01-04 13:24:01 (15.2 MB/s) - `index.html' saved [11692/11692]

User avatar
DougieLawson
Posts: 39124
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Error 403 Forbidden - Webserver

Mon Jan 04, 2016 2:09 pm

The public side sent this

Code: Select all

Server: Apache
your local system sent this

Code: Select all

Server: Apache/2.2.22 (Debian)
so my theory is proven, your router/switch isn't doing the port forwarding stuff for port 80 on your public interface.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

grezmel
Posts: 7
Joined: Sun Jan 03, 2016 8:39 pm

Re: Error 403 Forbidden - Webserver

Mon Jan 04, 2016 2:38 pm

hmmm, i wonder why it has changed though I has havent made any changes to the router or pi

User avatar
DougieLawson
Posts: 39124
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Error 403 Forbidden - Webserver

Mon Jan 04, 2016 3:24 pm

Have you checked that 2.127.21.102 is your current public IP address?

curl -s http://httpbin.org/ip
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

hello world :-)
Posts: 121
Joined: Sat Nov 14, 2015 7:12 am
Location: England, in an insecure cloud, ie. The Interwebs
Contact: Website Yahoo Messenger AOL

Re: Error 403 Forbidden - Webserver

Thu Jan 07, 2016 7:47 am

Try changing the file/folder's owner to www-data . That helped me. The downside to this is that they won't belong to the Pi user anymore, so you won't be able to edit them if you're not logged in as root...
I do moral support. Here: https://www.raspberrypi.org/forums/search.php?search_id=egosearch
I know I use too many parentheses. Problem?
Topics I have posted in: http://bit.ly/1NbDdr5
My topics: http://bit.ly/1ObnKqQ
All my posts: http://bit.ly/1OHzje7

grezmel
Posts: 7
Joined: Sun Jan 03, 2016 8:39 pm

Re: Error 403 Forbidden - Webserver

Sun Feb 14, 2016 2:42 pm

Ive been trying to get this resolved for a while now on and off and I think I know what has caused the issue. I purchased a WD Mycloud drive which I think is probably conflicting with the Raspberry. Just need to work out how to resolve :(

Return to “General discussion”