Home Forums Support nginx install will not work in sub-directory, only in root?

This topic contains 3 replies, has 2 voices, and was last updated by  Titanfail 1 month, 4 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #22131

    undrwater
    Participant

    I’m installing here at home to trial before pushing to my business server. My home server doesn’t have a fqdn, but runs on it’s own IP address.

    I initially ran into many “forbidden” errors when trying to set Ninja up, and I was pulling out my hair. Finally, I was able to get to the setup screen, but it’s not right.

    My server is on <ipaddress>, Invoice Ninja is at <ipaddress>/htdocs/ninja/

    Pointing a web page to <ipaddress>/htdocs/ninja gives me the “forbidden” error, however pointing to <ipaddress> gives me the Invoice Ninja setup screen! That’s of course NOT what I want. I want to get the setup screen at <ipaddress>/htdocs/ninja (and maybe /public).

    I’ve read a few forum posts where folks want to do what I’m doing, but not succeeding. Has anyone done this successfully, and what do I need to change?

    I’m happy to provide logs or whatever else is needed. My business server hosting provider is 1and1. I’m not sure what I’m going to need for this to work there, but I’d like to get it working locally first.

    Thanks in advance!

    #22132

    Titanfail
    Participant

    It sounds like your root folder is already set to /htdocs/ninja, so when you go to http://address it works because it’s pointing to /htdocs/ninja. But when you try to go to http://address/htdocs/ninja, nginx thinks you’re wanting to go to /htdocs/ninja/htdocs/ninja.

    Ideally, you want root (or DocumentRoot if using Apache) to point to /ninja/public. This is because if you’re pointing anywhere higher up, anyone could simply pull up http://yourURL/.env and see all of your credentials. Setting the DocumentRoot to /public and having the .env file above that prevents just such things.

    It is possible to install Laravel applications in subfolders, but it requires putting certain assets outside of the main folder, and modifying /public/index.php to point to those. And all those changes would be lost when updating.

    What you might want to consider instead (if you already have other stuff running on the webserver) is installing Invoice Ninja in a subdomain instead of a subfolder. So instead of http://address/ninja/, you would have something like http://ninja.address. That involves customizing DNS entries and other things outside of my expertise, but would be a much better alternative.

    #22148

    undrwater
    Participant

    Thank you! Really good thoughts.

    I changed my root to /ninja/public, and…the whole site came down. Even with this, I think you’ve got me on the right track. I have a better idea how things are working.

    Thank you!

    I’ll look into the subdomain idea; though of course that won’t work on my internal server.

    #22149

    Titanfail
    Participant

    For a personal server, probably the easiest thing would be to setup a base Linux install (or even a Linux VM), and use the Ansible installer.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Posted in: