3

I'm trying to make a local website using OS X Server (4.0.3), and am following the tutorial that comes with Server. When I use Safari on another Mac, when I try to go to the website (myserver.local) the website doesn't load/is stuck 1/3 of the way loading.

The Server Tutorial is in the help menu (Help > Server Tutorials > Host a website > Lesson 1):

I've summarized the steps I took, and there didn't seem to be anything wrong following each step:

https://help.apple.com/serverapp/mac/getstarted/4.0/#/apd9a7f7c98f

Lesson 1: Create a private, local, dynamic website

In this lesson, you’ll learn:

  • How to create a private website on your local network that uses a web app to produce webpages
  • How to enable and select Python web apps
  • How to use a built-in Python web app as a default webpage

Step 1. Select Websites

  • Open the Server app to see the list of services available in OS X Server. Select Websites.

Step 2. Enable Python web apps

  • Select “Enable Python web applications.”

    Arrow indicating Python setting

Step 3. Add a website

  • Click the Add button add.

    Enter the following information in the website creation pane:

    • Enter the server’s local host name—for example, “myserver.local.”

      This is the name that Safari users on your local network use to view the website.

    • Select the server’s local network IP address from the pop-up menu.

    • Leave the SSL certificate as “None.”

Don’t click Create yet.

Step 4. Enable the sample Python web app to generate the webpages

  • Click Edit Advanced Settings, then select “Python ‘Hello World’ app at /wsgi.” Then click OK.

    Arrow indicating enabled web app

Note: Once you get this working, you could add your own web apps written in Python.

Step 5. Make the Python page the default index page

  • Return to the website creation pane, and click Edit next to Index Files. Add an index called “/wsgi” and drag it to the top of the list, then click OK.

    Arrow indicating add button

Step 6. Create the site

  • After the configuration is finished, click Create to make the new site.

Step 7. Test your configuration

  • Open Safari and go to the site URL (myserver.local, in this lesson) to see the generated page.

However, the test is failing with Safari stuck 1/3 of the way loading by looking at the progress in the address/search field. How can I figure out what's wrong with my server and/or setup?

  • Could you link to the tutorial by editing the question (or describing in more detail how you have things set up?) – bmike Mar 29 '15 at 1:41
  • I used the built in OSX Server tutorial (under help > tutorials > websites > local website), all it said was to add a website in 'websites' give it a domain name of 'myserver.local', and enable the 'hello world' Python app. That's all I did @bmike – Mahmud Assamaray Mar 29 '15 at 1:44
  • Very nice edit. I'll get an answer started using terminal to debug things. Hopefully it's quick to isolate. Hop into the Ask Different Chat if you're not sure what to make of my initial thoughts on debugging this setup. – bmike Mar 29 '15 at 9:21
3

Here's how I'd troubleshoot things using terminal. You can use the console app as well to look at logs, but the serveradmin commands are more detailed than the server app allows currently and historically.

  1. curl localhost - this tests that port 80 is listening and a web server is running.
  2. sudo serveradmin status web - this tests the service named web - n.b. you could have the curl command work and have apache running on port 80 but have your web status STOPPED as several other "services" start up apache such as Xcode, Profile Manager, etc...
  3. Depending if the status was stopped, issue a start sudo serveradmin start web or issue an orderly shutdown and restart sudo serveradmin stop web && sleep 15 && sudo serveradmin start web

If you are not getting anything that makes sense from curl - perhaps look over the web logs:

tail /var/log/apache2/access_log
tail -20 /var/log/apache2/error_log

Once you've narrowed down if the problem is running apache and basic networking/DNS to get localhost to work or if there are problems with the code/content you can take next steps.

Also, looking over the tutorial/lesson - it looks like the selection was on HTTPS and not HTTP, so go back and ensure you are using https://myserver.local and https://localhost or http:// throughout and the server app is configuring the port (80 for http and 443 for https). For simplicity, I've just used port 80 for this answer and my server setup.

  • When I did curl localhost, I got this: "curl: (7) Failed to connect to localhost port 80: Connection refused" EDIT: Now I'm getting an html document, I think it is Xcode/server itself – Mahmud Assamaray Mar 30 '15 at 20:21
  • 2
    I know it seems obvious, but perhaps not to everyone: myserver.local is an example. Unless your server is called "myserver", or the entry is set in /etc/hosts, the connection won't work. So if your computer is called "Colorado", then you must create the test site at Colorado.local. You can check this under Server - (your server name) - Overview - Host Name. – Jay Versluis Oct 8 '15 at 1:51
  • 1
    @MahmudAssamaray How did you get it working? My website still doesn't load – coder hacker Jan 21 '16 at 3:18
  • @coderhacker you should ask another question with your configuration. I'm finding it really hard to make a service that is running locally work over the internet even with the port open. – Aran Mulholland Apr 13 '16 at 6:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .