Trying to set up web server on Monterey

I have followed, with 99% success, etresoft's excellent guide to setting up a server on Monterey. I am guessing too many people asked questions because I do not find a way to ask one on his page.


I get a SCALAR error (?) when I run the info.pl command via "perl info.pl" from the command line. When I try to execute it from the URL line I get Safari cannot open page. I did, at one point, get the same scalar value but now Safari just complains. Everything else works.


I know it has to be something I am doing (did) wrong. Just not able to determine what.


I have my own registered domain name but I didn't use it for anything other than a vanity site. I would like to be able to get to it from "out there" and to, eventually, set up my own mail server as well.


I got tired of paying $$ for something I feel I should be able to do from my desktop.


As always, any and all help gratefully received.


2018 Mac Mini running latest Monterey.


Thanks,


Skip



Mac mini 2018 or later

Posted on Sep 1, 2022 10:12 AM

Reply
Question marked as Top-ranking reply

Posted on Sep 1, 2022 5:47 PM

skiph wrote:

If I run the command from the command line with "perl info.pl" , I now just get a blank. I was getting the SCALAR message.

It sounds like you've fixed whatever was wrong with the Perl script. I didn't want to have a complicated demo script. It just prints the mod_perl version. If you aren't running under mod_perl inside Apache, then there is no mod_perl version and it prints nothing.

If I run it from safari, I get:

Sometimes Safari can cache results or do other odd things. I did test this while I composed my reply and got it working on Monterey. It did take a couple of tries. I think that was because while doing:


sudo vi /etc/apache2/users/<your short user name>.conf


I forgot to change "<your short user name>" in the contents. So I had to fix that and then restart Apache again. But then it did work.


And finally, what operating system are you using? So far, I've failed to get it running on [redacted], if you know what I mean. 😉😉

Similar questions

7 replies
Question marked as Top-ranking reply

Sep 1, 2022 5:47 PM in response to skiph

skiph wrote:

If I run the command from the command line with "perl info.pl" , I now just get a blank. I was getting the SCALAR message.

It sounds like you've fixed whatever was wrong with the Perl script. I didn't want to have a complicated demo script. It just prints the mod_perl version. If you aren't running under mod_perl inside Apache, then there is no mod_perl version and it prints nothing.

If I run it from safari, I get:

Sometimes Safari can cache results or do other odd things. I did test this while I composed my reply and got it working on Monterey. It did take a couple of tries. I think that was because while doing:


sudo vi /etc/apache2/users/<your short user name>.conf


I forgot to change "<your short user name>" in the contents. So I had to fix that and then restart Apache again. But then it did work.


And finally, what operating system are you using? So far, I've failed to get it running on [redacted], if you know what I mean. 😉😉

Sep 2, 2022 4:09 AM in response to etresoft

Bada Bing!


Thanks for the brain bump. After I re-did the script and got the blank line while running the command from the CL, I didn't restart apache. Did so this morning and it works! As my hero would say, "D'oh!"


Now since all the "simple" stuff is now working I get to start playing with the hard stuff.


If/when I get this working like a "real" website, I will isolate my Mac. Or I have an (really) old linux machine that hasn't been plugged in for years. I may have to dust off the penguin and try my hand there.


I am a trusting soul. I update my Macs every time Apple tells me to. After this amount of time, (> 20 plus years having a Mac) I figure if Apple breaks it, they'll fix it. Like I say, trusting.


And btw I believe [redacted] has been proven to be more trouble than it's worth IYKWIM? 🤔


Thanks for your help. And you KNOW I will be back.

Sep 1, 2022 1:24 PM in response to skiph

skiph wrote:

This is much different that what you just showed me.

I must have been playing around with something. What is posted in that User Tip is correct. (Actually it has a bug, but that shouldn't matter.) I tried it just now in Monterey and it worked fine.


This is what it should be:

echo "print \$ENV{MOD_PERL} . qq{\\\\n};" > ~/Sites/info.pl


And then in your browser window it should say:

mod_perl/2.0.9

By "vanity" I mean just that. Where I post stuff to satisfy my own vanity. OK?

Yeah. I get it. I just don't like the word "vanity". It's a pejorative. I think it is a really good idea for people to have their own domain names. Just make sure it is something clever and not your actual name. Never post any personal information on the internet! Always use privacy settings for your domain name registrar.

Don't have a carts or use SSL.

SSL is a Good Thing, but it can be difficult and expensive to setup.

I have built web pages but I have never set up a web server.

So what is the exact error you get from running that Perl script on the command line? It may be something as simple as using smart quotes instead of traditional quotes.

Sep 1, 2022 10:26 AM in response to skiph

skiph wrote:

I am guessing too many people asked questions because I do not find a way to ask one on his page.

In fact, you may be one of the first people to ever mention it. What "his page" are you referring to? There are comments available on those User Tips, but no one ever uses them. Otherwise, I'm easily found on the internet.

I get a SCALAR error (?) when I run the info.pl command via "perl info.pl" from the command line. When I try to execute it from the URL line I get Safari cannot open page. I did, at one point, get the same scalar value but now Safari just complains. Everything else works.

What does your info.pl file look like? It's just:


print "<html><body><h1>My Perl site works</h1></body></html>";


a vanity site.

No such thing. Always own your own domain name.

I would like to be able to get to it from "out there" and to, eventually, set up my own mail server as well.

I got tired of paying $$ for something I feel I should be able to do from my desktop.

Those instructions I posted are only intended for developers. If you are developing a web site, you want to see it run before publishing it for the rest of the world.


However, you most definitely don't want to run any of this from your desktop. You should be able to do it all on AWS for free or pocket change.

Sep 2, 2022 4:39 AM in response to skiph

skiph wrote:

I believe [redacted] has been proven to be more trouble than it's worth IYKWIM? 🤔

Don’t believe what you read on the internet. I can’t discuss these matters here in the forum, but I will tell you that it is not an Apple problem, at least not directly.


The idea behind these User Tips is to setup a working version of Apache that can be used to design web pages. I build all my web sites in Xcode. I just click build in Xcode and then refresh in Safari to see the changes.


However, I would never deploy a site on a Mac, or on a personal server for that matter. There are too many other options are are far more reliable, less hassle, and inexpensive, sometimes even free. I mentioned AWS. They have a free tier. You can also publish websites on GitHub for free.

Sep 1, 2022 11:22 AM in response to etresoft

OK, this is what I meant by "his" (your) page: Setting up a local web server on macOS 12… - Apple Community


I saw where a few folk had asked questions on this page: Setting up a local web server on a Mac - Apple Community


And I could not find where to post a question. Missed the button I guess.


My pl file was built using your suggested:

This is much different that what you just showed me.


By "vanity" I mean just that. Where I post stuff to satisfy my own vanity. OK? Not a commercial site. Don't have a carts or use SSL. I have "owned" my domain for, literally, decades. Never did anything with it but post things I was interested in and shared with family/friends/whomever. And have/had paid for the privilege which is why I want to run my own.


And since I am trying to do all this on my Mac, I AM developing.


I really appreciate all the help you (etresoft) have given me over the years. And that's all I am looking for again.


If/when I get something that works, I will see about getting set up with Amazon's AWS.


I have built web pages but I have never set up a web server.

Sep 1, 2022 4:18 PM in response to etresoft

If I run the command from the command line with "perl info.pl" , I now just get a blank. I was getting the SCALAR message.


If I run it from safari, I get:



I don't mind that you see my "short name"


As to "vanity" being pejorative. Mebbe so, but I don't denigrate myself. I save that fun for others.


-rw-r--r--  1 cjh  staff  31 Sep  1 17:37 info.pl


The above is the ownership and permissions of the file. Same permissions as are on my index.html.en file.


Tried it with and without smart quotes. No joy.


I'll do some more research on this. I have a MacBook that I will try this whole set up and see if I get different results.


Thanks for your efforts.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Trying to set up web server on Monterey

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.