logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Raspberry PI :: What is Wrong Page 1, 2  Next
Author
Timlab55



Joined: 07 Nov 2021
Posts: 17
Location: Aiken

PostPosted: Sun 07 Nov '21 19:06    Post subject: Raspberry PI :: What is Wrong Reply with quote

Okay, I'm trying my hardest to get a webserver/website up on my raspberry pi. I have apache2 install right, or I've done what they say to do to test it and I get the apache2 page. After that, I put all my html files/php files in the html folder of my pi without changing any of the permissions along the way. I've change the .conf file in apache2 per apache2 instructions. The bottom line is I believe I've done everything right. What's wrong is my ISP will NOT give me a static IP address. I've gotten and registrar my domain on Google and followed their instructions to the "T". With all this being said how come I can't go live with this website?
Is there away to trace from the time I enter the URL on my home computer to my raspberry pi and back again to find out where it's hanging up at?
Thanks
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 348
Location: UK

PostPosted: Mon 08 Nov '21 21:53    Post subject: Reply with quote

You've got two issues here:-

1) Apache Functionality
2) Remote Connectivity

In your decription of your Apache setup, you've not confirmed if the Raspberry Pi site works as expected from a client on your local network. Let's assume that it does (using an IP address at least). If not, that's the first thing you need to resolve.

Connectivity wise, if your ISP won't provide you with a static IP, I assume you've registered with a dynamic DNS service such as DynDNS or NoIP, and you've then configured your router to work with that Dynamic DNS service provider.

With that in place, the final part of the puzzle will be you'll need to configure port forwarding on your router, from the Internet to the Raspberry Pi (port 80 HTTP / port 443 HTTPS).

You should then be able to connect to your Apache server remotely, using the registered dynamic DNS hostname. You can also check the port forwarding with one of many online test sites, e.g. https://www.portcheckers.com
Back to top
Timlab55



Joined: 07 Nov 2021
Posts: 17
Location: Aiken

PostPosted: Tue 09 Nov '21 0:41    Post subject: Reply with quote

I think I might have more than 2, but we will see. To determine what is going on, can we take this step by step please. If you don't mind tangent or anyone else, could I ask that you look at this article https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-18-04
These are the instructions that I have followed to the "T".
Thanks
Back to top
Timlab55



Joined: 07 Nov 2021
Posts: 17
Location: Aiken

PostPosted: Tue 09 Nov '21 1:41    Post subject: Reply with quote

I think problem #1 is this:
I ran the command sudo apachectl configtest
and the results where this:
AH00112: Warning: DocumentRoot [/var/www/gamblerlotteryclub/public_html] does not exist
Syntax OK
Trust me when I tell you that /var/www/gamblerlotteryclub does exist.
I also ran this command sudo service httpd start
and the results where:
Failed to start httpd.service: Unit httpd.service not found.


Thanks
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Tue 09 Nov '21 22:34    Post subject: Reply with quote

For apachectl see https://httpd.apache.org/docs/2.4/programs/apachectl.html
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 348
Location: UK

PostPosted: Tue 09 Nov '21 22:40    Post subject: Reply with quote

Two observations.

Your configtest warning says the DocumentRoot directory doesn't exist (/var/www/gamblerlotteryclub/public_html), whilst your "trust statement" says /var/www/gamblerlotteryclub does exist. Ok, but is there a public_html directory below /var/www/gamblerlotteryclub?

On Ubuntu / Raspberry Pi, you should use systemctl rather than the service command, e.g.
Code:
# sudo systemctl start apache2
# sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2021-11-09 20:26:02 GMT; 4s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 3699 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 3718 (apache2)
      Tasks: 55 (limit: 2316)
     Memory: 5.3M
     CGroup: /system.slice/apache2.service
             ├─3718 /usr/sbin/apache2 -k start
             ├─3719 /usr/sbin/apache2 -k start
             └─3720 /usr/sbin/apache2 -k start
Back to top
Timlab55



Joined: 07 Nov 2021
Posts: 17
Location: Aiken

PostPosted: Wed 10 Nov '21 0:18    Post subject: Reply with quote

This is what I received when I did it your way:
apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2021-11-07 16:49:57 EST; 2 days ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 1095 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS)
Main PID: 598 (apache2)
Tasks: 6 (limit: 4915)
CGroup: /system.slice/apache2.service
├─ 598 /usr/sbin/apache2 -k start
├─1123 /usr/sbin/apache2 -k start
├─1124 /usr/sbin/apache2 -k start
├─1125 /usr/sbin/apache2 -k start
├─1126 /usr/sbin/apache2 -k start
└─1127 /usr/sbin/apache2 -k start

Nov 07 16:49:56 raspberrypiws systemd[1]: Starting The Apache HTTP Server...
Nov 07 16:49:57 raspberrypiws apachectl[510]: 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
Nov 07 16:49:57 raspberrypiws systemd[1]: Started The Apache HTTP Server.
Nov 09 17:13:00 raspberrypiws systemd[1]: Reloading The Apache HTTP Server.
Nov 09 17:13:00 raspberrypiws apachectl[1095]: 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
Nov 09 17:13:00 raspberrypiws systemd[1]: Reloaded The Apache HTTP Server.
~
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 348
Location: UK

PostPosted: Wed 10 Nov '21 19:23    Post subject: Reply with quote

Ok, so your Apache instance runs, but predictably it's complaining that it can't resolve the server's fully qualified domain name. This is expected for systems where a fully qualified domain name hasn't been established for the host server.
    Nov 07 16:49:57 raspberrypiws apachectl[510]: 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
This warning doesn't stop Apache serving requests, so you should be able to connect to your Raspberry Pi server from a client browser elsewhere on your local network, using an IP address at least. With that working, you should be able to develop and test your site content.

Thereafter, you can move on to the second problem area I mentioned, namely remote connectivity.

Did you register a dynamic DNS address against your ISP connection?
Back to top
Timlab55



Joined: 07 Nov 2021
Posts: 17
Location: Aiken

PostPosted: Wed 10 Nov '21 20:46    Post subject: Reply with quote

Quote:
Did you register a dynamic DNS address against your ISP connection?


I did go to google domains and did their setup. I think I have solved the problem. They were asking for my IVP4 address and I was inputting my Public IP address. So this morning, I put in my IVp address (the one to the computer) and now I typed in the URL the address and it work Smile. Now I have to work on the SSL part. Know anything about that?
Thanks

[/quote]
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 348
Location: UK

PostPosted: Thu 11 Nov '21 0:17    Post subject: Reply with quote

This site contains a wealth of expert view and opinion, including details for configuring SSL.

Suggest you use the search feature, and look at the "How-to's & Documentation & Tips", e.g. Steffen's post at https://www.apachelounge.com/viewtopic.php?p=35959
Back to top
Timlab55



Joined: 07 Nov 2021
Posts: 17
Location: Aiken

PostPosted: Thu 11 Nov '21 5:11    Post subject: Reply with quote

This is what I get after I dump the old copy and reinstall it again and only install apache2.
apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-11-10 13:05:36 EST; 9h ago
Docs: https://httpd.apache.org/docs/2.4/
Main PID: 2567 (apache2)
Tasks: 55 (limit: 4915)
CPU: 2.631s
CGroup: /system.slice/apache2.service
├─2567 /usr/sbin/apache2 -k start
├─2569 /usr/sbin/apache2 -k start
└─2570 /usr/sbin/apache2 -k start

Nov 10 13:05:36 web systemd[1]: Starting The Apache HTTP Server...
Nov 10 13:05:36 web apachectl[2566]: 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
Nov 10 13:05:36 web systemd[1]: Started The Apache HTTP Server.
~
I noticed that under Main PD your numbers are different than mine. I also noticed that all your numbers are different then mine. Why is that?
Thanks
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 348
Location: UK

PostPosted: Thu 11 Nov '21 22:31    Post subject: Reply with quote

Every process running on your computer has a unique Process ID, so the PIDs reported in the 'systemctl status apache2' output are bound to differ from one computer to another.

Various other commands can be used to filter the active process list, e.g.
Code:
$ pgrep -a apache2
2342 /usr/sbin/apache2 -k start
2343 /usr/sbin/apache2 -k start
2344 /usr/sbin/apache2 -k start

or the ps command if you want to see more process detail, e.g. 'ps uax' or 'ps -ef'
Code:
$ ps uax | grep apache2 | grep -v grep
root        2342  0.0  0.2   6748  4480 ?        Ss   20:07   0:00 /usr/sbin/apache2 -k start
www-data    2343  0.0  0.2 1211636 4500 ?        Sl   20:07   0:00 /usr/sbin/apache2 -k start
www-data    2344  0.0  0.2 1211636 4500 ?        Sl   20:07   0:00 /usr/sbin/apache2 -k start

Linux (Unix) is a very big rabbit warren. Be careful how deep you go...
Back to top
Timlab55



Joined: 07 Nov 2021
Posts: 17
Location: Aiken

PostPosted: Fri 12 Nov '21 2:36    Post subject: Reply with quote

I was following this article along and figure I would like to know how to manage 2 or more websites once I get the first one going. However, at this writing that is still far off in the distances. Anyway this is the article located at https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-18-04

Everything was going fine up to step #5 and this is what I got slap in the face with:
pi@web:~ $ sudo a2ensite example.com.conf
Enabling site example.com.
To activate the new configuration, you need to run:
systemctl reload apache2
pi@web:~ $ sudo systemctl reload apache2
Job for apache2.service failed.
See "systemctl status apache2.service" and "journalctl -xe" for details.
pi@web:~ $ sudo systemctl status apache2.service
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2021-11-11 19:19:51 EST; 7min ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 7469 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=1/FAILURE)
Main PID: 7161 (apache2)
Tasks: 55 (limit: 4915)
CPU: 185ms
CGroup: /system.slice/apache2.service
├─7161 /usr/sbin/apache2 -k start
├─7163 /usr/sbin/apache2 -k start
└─7164 /usr/sbin/apache2 -k start

Nov 11 19:19:51 web systemd[1]: Starting The Apache HTTP Server...
Nov 11 19:19:51 web apachectl[7160]: 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
Nov 11 19:19:51 web systemd[1]: Started The Apache HTTP Server.
Nov 11 19:26:12 web systemd[1]: Reloading The Apache HTTP Server.
Nov 11 19:26:12 web apachectl[7472]: AH00526: Syntax error on line 14 of /etc/apache2/sites-enabled/example.com.conf:
Nov 11 19:26:12 web apachectl[7472]: DocumentRoot takes one argument, Root directory of the document tree
Nov 11 19:26:12 web apachectl[7469]: Action 'graceful' failed.
Nov 11 19:26:12 web apachectl[7469]: The Apache error log may have more information.
Nov 11 19:26:12 web systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Nov 11 19:26:12 web systemd[1]: Reload failed for The Apache HTTP Server.

First off, I hope I'm not pissing anyone off with this stuff, but I did come here to learn.
I have managed to get this to work tho:
http://www.gamblerlotteryclub.com without any problems, and why do I have the problems?
Thanks in Advance
[/url]
Back to top
Timlab55



Joined: 07 Nov 2021
Posts: 17
Location: Aiken

PostPosted: Fri 12 Nov '21 4:53    Post subject: Reply with quote

Never mind, took a break (1 1/2 hours) and came back and notice that it was some misspellings. All is good up to the point of getting it to come up in the browser. So what do you guys need from me to show me how I can get these two web sites to come up EVEN after I followed the directions to the "T" and check it twice after the break?
Thanks
Dan
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 348
Location: UK

PostPosted: Fri 12 Nov '21 23:19    Post subject: Reply with quote

Please clarify the ambiguity when you say:

Timlab55 wrote:
I have managed to get this to work tho:
http://www.gamblerlotteryclub.com without any problems, and why do I have the problems?
Thanks in Advance
[/url]

If your web site displays ok in a local network browser, what problems are you talking about? SSL, or remote access; in which case please refer to the recommendations in previous posts.
Back to top
Timlab55



Joined: 07 Nov 2021
Posts: 17
Location: Aiken

PostPosted: Sat 13 Nov '21 0:01    Post subject: Reply with quote

Tangent I was kinda of hoping you would try the URL and tell me if you received it correctly or not. If you haven't tried it, could you please and tell me want you got.
Thanks
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 348
Location: UK

PostPosted: Sat 13 Nov '21 0:16    Post subject: Reply with quote

My browser connection times out; I get nothing. But then this explains why.
Code:
C:\>nslookup www.gamblerlotteryclub.com
Server:  pi.hole
Address:  192.168.1.190

Non-authoritative answer:
Name:    www.gamblerlotteryclub.com
Address:  192.168.1.73

The IP address you've assigned for your site in DNS is non-routable over the Internet, namely 192.168.1.73. It's a Class C private network, the one usually used for home networks.

You previously mentioned your ISP doesn't provide a static Internet facing IP, so you'll need to go down the dynamic DNS path, as mentioned above.
Back to top
Timlab55



Joined: 07 Nov 2021
Posts: 17
Location: Aiken

PostPosted: Mon 15 Nov '21 5:48    Post subject: Reply with quote

Tangent -
I've been hard at work trying to get this right. I finally had it out with google and they assign the right person to my case. We figure it out and now it works. Please revisit it again, because now I have another problem in which since your the expert in Apache2, I will need your help.
Thank you kind sir.
Dan
Back to top
Timlab55



Joined: 07 Nov 2021
Posts: 17
Location: Aiken

PostPosted: Mon 15 Nov '21 6:57    Post subject: Reply with quote

Tangent - Update - READ THIS FIRST! I did have the site up and running because googles saw it and read back to me the first line of it. So if they got it, I'm sure you would of too. So tonight I figure out what the problem was (because I had hints), and now I have another problem. Could you please visit my site again and tell me what you think it is?

Thanks
Dan
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 348
Location: UK

PostPosted: Mon 15 Nov '21 13:38    Post subject: Reply with quote

You're nearly there, including setting up an SSL frontend I see (TLS1.2 and TLS1.3 only which is good).

However, the Common Name of your site certificate is set to gamblerlotteryclub.com, whereas you've posted your site to be www.gamblerlotteryclub.com. Hence, client browsers will complain about the site certificate due to the name mismatch.

Checking from the command line with OpenSSL confirms this:

Code:
$ openssl s_client -connect www.gamblerlotteryclub.com:443
CONNECTED(00000003)
depth=2 C = US, O = Internet Security Research Group, CN = ISRG Root X1
verify return:1
depth=1 C = US, O = Let's Encrypt, CN = R3
verify return:1
depth=0 CN = gamblerlotteryclub.com
verify error:num=9:certificate is not yet valid             <============== verify error reported
notBefore=Nov 15 01:41:07 2021 GMT
verify return:1
depth=0 CN = gamblerlotteryclub.com
notBefore=Nov 15 01:41:07 2021 GMT
verify return:1
---
Certificate chain
 0 s:CN = gamblerlotteryclub.com
   i:C = US, O = Let's Encrypt, CN = R3
 1 s:C = US, O = Let's Encrypt, CN = R3
   i:C = US, O = Internet Security Research Group, CN = ISRG Root X1
 2 s:C = US, O = Internet Security Research Group, CN = ISRG Root X1
   i:O = Digital Signature Trust Co., CN = DST Root CA X3
<snip>

What you need do is add www.gamblerlotteryclub.com to your Let's Encrypt site certificate, as an Subject Alternate Name (SAN) entry. Then users will be able to connect to either URL without a certificate error.
Back to top


Reply to topic   Topic: Raspberry PI :: What is Wrong View previous topic :: View next topic
Post new topic   Forum Index -> Apache Page 1, 2  Next