Permlink Replies: 22 - Pages: 2 [ Previous | 1 2 ] - Last Post: 10-Nov-2017 16:43 Last Post By: jGromit Threads: [ Previous | Next ]
RobM

Posts: 4,383
Registered: 4-Aug-2006
Re: Local Preview
Posted: 08-Nov-2017 13:33   in response to: karlmistelberger in response to: karlmistelberger
  Click to reply to this thread Reply
karlmistelberger wrote:
RobM wrote:
I think I’ll stick to keeping my OS firewall active after reading this article

The article points out that roaming devices may easily and inadvertently short circuit the firewall of your gateway, which is an important point. Wearing a tin foil hat won't help much. Always having in mind the topology of your LAN is a good idea, see this example. When it comes to content filtering there are more versatile solutions.

Yes, iOS does not have a firewall but it is pretty well tied down.
RobM

Posts: 4,383
Registered: 4-Aug-2006
Re: Built in server
Posted: 10-Nov-2017 00:27   in response to: drmikey in response to: drmikey
  Click to reply to this thread Reply
drmikey wrote:
This may not be what you're lookng for, but I have been running an Apache Web server on my Mac since OS X first came out (~ 2000) and test my skins and web pages on it with no thoughts of any firewall. You can even add PHP if you need it.
I just use OS X's built in Webserver folder, Mac HD ---> Library --> Webserver --> Documents . I make a new folder for my Jalbum output within this folder and then point my browser to
 your.macs.ip.address/Your-Jalbum-output-folder 
. For me it is
10.0.0.1/jalbum/ 
.
The small issue, is that Apple removed the easy way to start your own Apache Webserver in the Sharing Control Panel about 4 versions back so you either have to use the Terminal or you could use this handy little script I wrote to start up your server automatically by making it a startup item. If you want to see what the code is before running it (to make sure I am not taking over your Mac), open it with Script Editor and look at the Code.
That works like a charm.
I have converted it to work as a service, accessible when jAlbum is running, to make it easier to use.
karlmistelberger

Posts: 736
Registered: 5-Dec-2013
Re: Built in server
Posted: 10-Nov-2017 08:37   in response to: RobM in response to: RobM
  Click to reply to this thread Reply
RobM wrote:
drmikey wrote:
This may not be what you're lookng for, but I have been running an Apache Web server on my Mac since OS X first came out (~ 2000) and test my skins and web pages on it with no thoughts of any firewall. You can even add PHP if you need it.
I just use OS X's built in Webserver folder, Mac HD ---> Library --> Webserver --> Documents . I make a new folder for my Jalbum output within this folder and then point my browser to
 your.macs.ip.address/Your-Jalbum-output-folder 
. For me it is
10.0.0.1/jalbum/ 
.
The small issue, is that Apple removed the easy way to start your own Apache Webserver in the Sharing Control Panel about 4 versions back so you either have to use the Terminal or you could use this handy little script I wrote to start up your server automatically by making it a startup item. If you want to see what the code is before running it (to make sure I am not taking over your Mac), open it with Script Editor and look at the Code.
That works like a charm.
I have converted it to work as a service, accessible when jAlbum is running, to make it easier to use.

Had a look at the code:
AMApplicationBuild 444.1 AMApplicationVersion 2.8 AMDocumentVersion 2 actions action AMAccepts Container List Optional Types com.apple.applescript.object AMActionVersion 1.0.2 AMApplication Automator AMParameterProperties source AMProvides Container List Types com.apple.applescript.object ActionBundlePath /System/Library/Automator/Run AppleScript.action ActionName Run AppleScript ActionParameters source property userpassword : "" on run {input, parameters}	 if userpassword is "" then display dialog "Please enter your password:" default answer "" set userpassword to text returned of result -- The repeat section below is an optional error checking routine to ensure the password is valid set the_password to "Undefined" repeat until the_password is "Correct" try set theFinderPID to do shell script "ps -axww | /usr/bin/grep '[/]Finder'| awk '{print $1}' | head -1" do shell script "renice 1 " & theFinderPID password userpassword with administrator privileges do shell script "renice 0 " & theFinderPID password userpassword with administrator privileges set the_password to "Correct" on error display dialog "Sorry, the password entered was not correct. Please try again:" default answer "" set userpassword to text returned of result end try end repeat end if tell application "Finder" set Choose_app to display dialog "Start or Stop Web Sharing" buttons {"Start", "Stop", "Cancel"} default button 3 with icon 1 if button returned of Choose_app = "Start" then do shell script "apachectl start" password userpassword with administrator privileges do shell script "/bin/launchctl load -w /System/Library/LaunchDaemons/com.apple.InternetSharing.plist" password userpassword with administrator privileges else if button returned of Choose_app = "Stop" then do shell script "apachectl stop" password userpassword with administrator privileges do shell script "/bin/launchctl unload -w /System/Library/LaunchDaemons/com.apple.InternetSharing.plist" password userpassword with administrator privileges end if end tell return input end run BundleIdentifier com.apple.Automator.RunScript CFBundleVersion 1.0.2 CanShowSelectedItemsWhenRun CanShowWhenRun Category AMCategoryUtilities Class Name RunScriptAction InputUUID 7081C883-CA73-4DC4-9012-5565B8350C5E Keywords Run OutputUUID 7172FCBD-1D44-497B-B54C-6794DC344F52 UUID 27CC42D7-EA77-4A85-BEB2-02D20B4AE79F UnlocalizedApplications Automator arguments 0 default value on run {input, parameters} (* Your script goes here *) return input end run name source required 0 type 0 uuid 0 conversionLabel 0 isViewVisible location 309.000000:316.000000 nibPath /System/Library/Automator/Run AppleScript.action/Contents/Resources/Base.lproj/main.nib isViewVisible connectors workflowMetaData serviceApplicationBundleID net.jalbum serviceApplicationPath /Applications/jAlbum.app serviceInputTypeIdentifier com.apple.Automator.nothing serviceOutputTypeIdentifier com.apple.Automator.nothing serviceProcessesInput 0 workflowTypeIdentifier com.apple.Automator.servicesMenu
vs.
   Alias "/Albums" "/home/Albums/jAlbums/"
   <Directory "/home/Albums/jAlbums/">Require all granted</Directory>
I will stay with a system which keeps the easy way of getting things done indefinitely.
drmikey

Posts: 867
Registered: 22-Dec-2006
Re: Built in server
Posted: 10-Nov-2017 09:19   in response to: karlmistelberger in response to: karlmistelberger
  Click to reply to this thread Reply
You should realize that the code is the AppleScript to make the small application to start and stop Apache, it is not the code one uses in the Terminal that actually starts the Webserver.
The simple Terminal commands are:
sudo apachectl start
 
sudo apachectl stop
 
sudo apachectl restart


You will need to enter your Mac password for sudo.

Sorry, but I don't know how this code is related to a server:

Alias "/Albums" "/home/Albums/jAlbums/"
   <Directory "/home/Albums/jAlbums/">Require all granted</Directory>


One must use what works best for them. I just like testing my code on a local server.
RobM

Posts: 4,383
Registered: 4-Aug-2006
Re: Built in server
Posted: 10-Nov-2017 10:15   in response to: drmikey in response to: drmikey
  Click to reply to this thread Reply
drmikey wrote:
You should realize that the code is the AppleScript to make the small application to start and stop Apache, it is not the code one uses in the Terminal that actually starts the Webserver.
Further to that, the code you looked at, apart from drmikey’s embedded script, is not something a Mac user writes. All I did was open the Automator application, create a ‘Service’ and added the script code. I then opted to have the service only show when jAlbum was the foreground application, as I would not be interested in seeing it at any other time.

The ‘Service…’ is a menu option that appears for every running application, Automator makes making a service easy, you can create a service without knowing any code.

As a long time Mac user I can say I only use terminal commands when absolutely necessary, a GUI always wins for me.
karlmistelberger

Posts: 736
Registered: 5-Dec-2013
Re: Built in server
Posted: 10-Nov-2017 16:02   in response to: drmikey in response to: drmikey
  Click to reply to this thread Reply
drmikey wrote:
You should realize that the code is the AppleScript to make the small application to start and stop Apache, it is not the code one uses in the Terminal that actually starts the Webserver.

I want to point out that contrary to wide spread belief installing and operating a web server can be much easier than telling a "user friendly" application with a GUI to use its own web server.

You should realize that to my 21 years of experience Linux never removes the easy way to accomplish a specific task. What you called "the small issue" is actually a big annoyance. Of course Apache on openSUSE can be configured and operated using the GUI coming with the OS

The simple Terminal commands are:
sudo apachectl start
sudo apachectl stop
sudo apachectl restart

You will need to enter your Mac password for sudo.

Linux has replaced these traditional scripts by systemctl with enhanced functionality. This has raised much dispute. On the other hand I consider this one of the biggest steps forward since creation of the Linux kernel.

Sorry, but I don't know how this code is related to a server:
Alias "/Albums" "/home/Albums/jAlbums/"
 <Directory "/home/Albums/jAlbums/">Require all granted</Directory>

Apache by default locks down access to the file system of the machine it is running on. The above directives tell Apache to open up the folder containing the albums and to map the path "/home/Albums/jAlbums/ to "Albums". So they can be viewed at: http://hofkirchen.lan/Albums/

One must use what works best for them. I just like testing my code on a local server.
That works for programmers. It works also for users viewing their albums locally without the hassle introduced by some browsers limiting the access to local files.
karlmistelberger

Posts: 736
Registered: 5-Dec-2013
Re: Built in server
Posted: 10-Nov-2017 16:29   in response to: RobM in response to: RobM
  Click to reply to this thread Reply
RobM wrote:
The ‘Service…’ is a menu option that appears for every running application, Automator makes making a service easy, you can create a service without knowing any code.

No need to create such a service on openSUSE Linux. It is available by default upon installation of Apache (1 click to select and another one to confirm). You may click start/stop (setting lost upon boot) and enable/disable (setting survives upon boot).

As a long time Mac user I can say I only use terminal commands when absolutely necessary, a GUI always wins for me.

As a long time user of all kinds of computers since the introduction of the 21MX E-Series I always opted for efficiency. Needless to add that I enjoyed vastly more time off than those opting for a GUI only.
jGromit

Posts: 33,192
Registered: 31-Jan-2006
Re: Built in server
Posted: 10-Nov-2017 16:43   in response to: karlmistelberger in response to: karlmistelberger
  Click to reply to this thread Reply
karlmistelberger wrote:
You should realize that to my 21 years of experience....

We stand in awe. Do you have any plaques or certificates you could share with us? It would make our day.
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums