Apache or NGINX ?

I'm curious - are CGI and Perl sooo yesterday ? If so, what've they been superseded by?

I'd say Python and JavaScript. You can do a lot with those. HTML5 also has some potent options for a markup language. Plus PHP, of course.

I'd contend that Perl is still a valid choice. Cheap web hosting now offers more choices these days, where they'd often only allow Perl back in the day. Heck, it took quite a while for the lower-end hosting companies to offer PHP back in the day.
 


I'm curious - are CGI and Perl sooo yesterday ? If so, what've they been superseded by?
Many web sites use CGI programs, like YouTube. Python and PHP are commonly used on web sites.

Signed,

Matthew Campbell
 
I'd say Python and JavaScript. You can do a lot with those. HTML5 also has some potent options for a markup language. Plus PHP, of course.

I'd contend that Perl is still a valid choice. Cheap web hosting now offers more choices these days, where they'd often only allow Perl back in the day. Heck, it took quite a while for the lower-end hosting companies to offer PHP back in the day.
When I was using WindoZe and Perl integrated into XAMPP (Apache alternative) I wrote a generic HTML pre-processor in Perl which read the target HTML doc and populated any pre-existing $variables quoted in the HTML. Also my own 'include' directive for importing externally held HTML code. Plan to expand on this once I've got Apache working with Perl and a certain website published.

Any guidance from you about installing Perl fully integrated with Apache so those calls to cgi-bin will work alright?
 
installing Perl fully integrated with Apache

It has been a while since I've done so but I think it's just as easy as installing Perl and then adding the current 'mod_perl' extension for Apache - editing the config if you want different paths. I recall it being relatively straightforward but it has been a while since I've needed to do so.
 
When I was using WindoZe and Perl integrated into XAMPP (Apache alternative) I wrote a generic HTML pre-processor in Perl which read the target HTML doc and populated any pre-existing $variables quoted in the HTML. Also my own 'include' directive for importing externally held HTML code. Plan to expand on this once I've got Apache working with Perl and a certain website published.

Any guidance from you about installing Perl fully integrated with Apache so those calls to cgi-bin will work alright?
I actually did something like this years ago for an 80C52 microcontroller. I wrote a program in C that translated the code to resolve label references and add line numbers. Then I had another C program that sent the data to the board using the serial port, I think it was /dev/ttyS1, as fast as the little computer could handle it. I was using Slackware back then. I think the serial interface ran at 9600 baud.

Signed,

Matthew Campbell
 
Great to hear you got Apache installed successfully! The issue you're encountering is likely due to permissions. Even though you installed Apache with your admin privileges, the /var/www/ and /var/www/html/ directories are owned by the root user by default.

To create your website folder, you’ll need to either change the ownership of the folder or use sudo to create it. Here's a quick way to handle this:
  1. Open a terminal.
  2. Use sudo to create the directory for your website. For example:View attachment 22179
    This will create a folder named myWebsite and set you as the owner.

  3. Once done, you can start adding your files to /var/www/html/myWebsite and Apache will be able to serve them. You’ll also want to ensure that the public_html folder is set to the correct permissions for web access, like:View attachment 22180

    This should get you up and running! Let us know if you run into any other issues.
What would the localhost call in the browser URL bar look like to open myWebsite/public_html/index.htm ?
(Assuming public_html is still the default target directory sought when opening the website's home page)
 
Screenshot_20241004_163610.png
 
Yes as I said at the beginning, just 'localhost' on its own successfully opens the default Ubuntu index.html document in the browser (var/www/html/public_html/index.html). But if my Apache directory structure also includes var/www/webSite1/ and a 2nd website at var/www/webSite2/ what follows the 'localhost' call then? (assume 'index.html' resides in both 'public_html' directories within each website)
 
Last edited:
Yes as I said at the beginning, just 'localhost' on its own successfully opens the default Ubuntu index.html document in the browser (var/www/html/public_html/index.html). But if my Apache directory structure also includes var/www/webSite1/ and a 2nd website at var/www/webSite2/ what follows the 'localhost' call then? (assume 'index.html' resides in both 'public_html' directories within each website)
If you type localhost you will probably get 127.0.0.1. If you want something else you'll need to type the numbers in the URL box. You can add lines to /etc/hosts to say 127.0.0.2 website2 and so on. Then you can just type website2 to get to the second web site. You don't need to add index.html after the directory if you tell your web server what file to load when the user requests a directory.

Signed,

Matthew Campbell
 
Thanks again Matthew. I was hoping there was a more intuitive way of typing the website to open for example 'localhost:webSite2/' So in Apache you're saying the std way is to type in the IP address as in your example. One has to remind one's self which IP address is which website. Seems a tad clumsy on Apache's part. How difficult would it be to add a 'look-up interface' that would translate the user friendly website call string into the IP address? Just curious ... unlikely to have time just yet to monkey around to achieve a more elegant way.

Presumably after typing in the IP address Apache will automatically go to the website's 'public_html/index.html' automatically in the standard setup?
 
Think I've just answered my own question. I could create a new webpage to replace the std Ubuntu home page with a hyperlinked list of my local websites which link using the IP address. All I need do is type 'localhost' to display that page ... Ta'daaa!
 
Thanks again Matthew. I was hoping there was a more intuitive way of typing the website to open for example 'localhost:webSite2/' So in Apache you're saying the std way is to type in the IP address as in your example. One has to remind one's self which IP address is which website. Seems a tad clumsy on Apache's part. How difficult would it be to add a 'look-up interface' that would translate the user friendly website call string into the IP address? Just curious ... unlikely to have time just yet to monkey around to achieve a more elegant way.

Presumably after typing in the IP address Apache will automatically go to the website's 'public_html/index.html' automatically in the standard setup?
You have a couple of options here. You could have a web site that redirects users to the web site of their choice from its home page, or you could run each web site on a different port. You could use 127.0.0.1:2001 for web site 1, 127.0.0.1:2002 for web site 2 and so on. I think the HTTP redirection codes are in the 300 range. You could simply have a master web site that had links to the different sub web sites on its home page. That would work too. The best part of being a developer is getting to make your own decisions about how you want things to look and work.

If you use port 2001 for web site 1 then you would use a VirtualHost statement in /etc/apache2/sites-available/000-default.conf using 127.0.0.1:2001 and so on for each of the others. Make sure to use a DocumentRoot statement in there as well to tell Apache2 which directory tree to use for that port. Then make sure to include a Directory statement in /etc/apache2/apache2.conf.

This way you can use localhost:2001 for web site 1, localhost:2002 for web site 2, and so on.

Signed,

Matthew Campbell
 
I'm fast coming to the conclusion that Apache is not for me on my Linux laptop. I'm unable to manage the target website folders via the Linux file manager and trying to do it from the cmd line within bash environment is proving painfully slow and
difficult.

So perhaps I'll abandon Apache and try XAMPP which I used before on Windoze. Hopefully XAMPP will prove a lot more user friendly on Linux as well. Then again maybe this is more a Linux issue than it is Apache ... guess I'll find out.

All this time just to try and manage target website folders under Apache and I've still to try to install and integrate Perl into Apache before I can even begin testing my CGI programs and subroutines. I'm assuming getting Perl to actually work on Apache within CGI is going to be every bit as slow and long-winded, probably moreso. On Windoze at least, XAMPP was immeasurably easier and faster to get up and running on than Apache is.

Very disappointed in Apache thus far.
 
Last edited:

Members online


Latest posts

Top