OS X localhost will obviously behave like pure UNIX OS, be it Mavericks or OS X Mountain Lion. It is possible to open localhost without installing Apache2 too. But, it is more important to understand which, what when, who and why. Blinding playing with OS X or any UNIX Operating System can be quite dangerous because usually we have a non-dedicated DNS for the Internet Connection from Internet Service Provider’s side. OS X manages these security part without asking you. You ran come command blindly, it asked password and you provided and run some chown command later, it is not unusual to get you HTML files indexed by Google bots! It frequently happens in many University student’s trial and error setup. Typically, if you search for Font like files, you might be able to find such IPs fully indexed! This is normal – you have given the full access to the System using improper commands.
OS X localhost : Understanding What Webserver Software Performs
We are taking that, you have a default setup, may be upgraded to current version of OS X from Mac OS X 10.6. If you are already running OS X localhost and has issues, it is not possible to solve reading this article. The guide to Install WordPress on Mac OS X With Command Line LAMP Configuration shows everything line by line for setting up Apache2 with the required modules.
What we want to say – you are running Apache2 in that case and if you has issues with it, this is not that kind of guide. This Apache2 is a webserver software. You can search on this website, there are many such – lighthttpd, nginx etc.
In these cases, we are running Apache2 core software and we can start the web server by this command :
sudo apachectl start
MAMP, Vamp etc. software are not needed for Mac, to be very honest. We are talking about using apt-get on Mac OS X and if you are finding MAMP, its sad. More software you will use, more the environment will become complex. If you do not have Apache2 installed, running this command :
will tell you “apache not found”. If you want to open access to port 8080 from the outside world (private lan) on Mac OS X, you can do it from other Apple computers :
Apple logo >Sys Preferences->Sharing->Enable œFile Sharing
This enables the smb and afp protocol. You can open the folder which this is pointing towards from command line :
Now, for a HTML file on my Desktop, I can open it on browser :
abhishekghosh is my UNIX username. Your should be different. Now from commandline, go to this folder :
Run ls command and you will see there is an index.html.en file. There are two Apple logo’s too, one is named PoweredByMacOSXLarge.gif. Obviously, you can open the location from Finder too, by simple right click on the Finder > Go To Folder, copy pasting the /Library/WebServer/Documents/ location. You can rename the HTML file to index.html. Try to double click and open the file on browser – you can not open it. Copy it to desktop and double click and open the file on browser – It Works! right? So, you can not open a simple HTML file…
That is where the security is for. When you are opening from Desktop, you are opening as user. The user document root level is missing the ‘~/Sites’ folder in the User account on a clean installation, you need to make a “Sites” folder at the root level of your account. But that way is for enabling Apache2 – you need the conf file.
You need to run these commands as root to show other users’ processes, for example:
sudo lsof -i ':80'
You will need this kind of script :
or Run some commands to make enable Openly without any Web Server Software. Here is where the thing happens – Font files get indexed due to improper permission. Be very careful if you do such things.
OS X localhost : Using WebServer Software
Control of OS X localhost becomes easy with a WebServer Software like Apache2. Yes, it is possible to do many things, many steps and ultimately you can open localhost & HTML files from that folder by typing localhost on Bowser – but, that is not what is wanted for Security purpose. Otherwise a WebServer software had no functions.Tagged With In this problem you need to find maximal and minimal elements of an array What could be simpler?