UgoL
UgoL

Reputation: 909

How to load up documentation with Sphinx on a subfolder of Debian server

I'm quite new to Sphinx side. I have read some stuff about it on Sphinx official documentation site and I have follow these steps for install and configure it on my Debian Wheezy server:

  1. First of all I have installed the Sphinx source on http://example.com/documentation-path/.

    pip install sphinx

  2. I have executed the script sphinx-quickstart for configuring the root directory and the conf.py.

    sphinx-quickstart

  3. I have executed the make html command for building HTML files in my directory path.

    make html

  4. I have installed the Sphinx autobuild for handle every changes/updates of my documentation, as written in a post made by @toast38coza.

    pip install sphinx-autobuild

    sphinx-autobuild source build/html

[What I have already fixed]

My first problem was that I couldn't get a correct view of the documentation index template since the server started watching changes on the documentation files at http://127.0.0.1:8000 (localhost at port 8000). So I get the same url path that I was expecting when I have installed it locally on my current PC. And as I said in the local version test it worked fine.

Since I was searching for something like that as URL path configuration (http://example.com), I decided to add arguments as -host and -port for let it works fine on Debian:

-p/--port option to specify the port on which the documentation shall be served (default 8000) -H/--host option to specify the host on which the documentation shall be served (default 127.0.0.1)

Then I have configured it, launched it and it worked fine:

>> sphinx-autobuild source build/html --host http://example.com --port8000 

So now if I surf http://example.com:8000 I get the correct view of the documentation index template.

[My main question]

How can I launch this view on a different URL path, for example a subfolder like http://example.com/documentation-path/, even considering that the root path of the Sphinx installation was /documentation-path/?

[My secondary question]

How can I automate the process of visualizing the template view without writing every times the instruction sphinx-autobuild with --port and --host on Debian console?

[Important Notice]

The Debian server is configured at this moment with NGINX which is completely new for me.

Upvotes: 4

Views: 3315

Answers (1)

UgoL
UgoL

Reputation: 909

Finally I have solved the subfolder path problem by myself with the help of NGINX documentation.

location /documentation {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_pass http://localhost:8000;
    index index.php index.html index.htm;
}

Regarding the autoload problem I have just switched from Sphinx to Markdown and after that I have used couscousPHP for generate a GitHub pages website from the markdown documentation.

This was for me the smarter way for provide static html files without autoload every time a source from the ssh console. In fact I can easily generate my conversion html file from .md file typing the command couscous generate.

Upvotes: 2

Related Questions