Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>EDIT: 05/23/2012 3pm PT US</strong></p> <p>If you're restricted to the user's directory, you can do pretty much whatever you want.</p> <p>What <em>used</em> to be the common case was that you put all of the CGI-using files (Perl, etc) into the <code>cgi-bin</code> directory and you can (and probably should) put those in subdirectories based on the purpose or application.</p> <p>Then you put the non-CGI files <em>outside</em> of the <code>cgi-bin</code> directory, which includes any bare HTML files, graphics files, CSS files, JS files, etc.</p> <p>For any programs that are used by the CGI files but not directly by the web user, do not put them in the webroot at all as that is not necessary and could be a security hole if the web user can submit values into those programs in some fashion.</p> <p>Directory tree example:</p> <pre><code>/home/www_maintainer/public_html/index.html /home/www_maintainer/public_html/images/logo.png /home/www_maintainer/public_html/scripts/something.js /home/www_maintainer/public_html/cgi-bin/application1/app1.cgi /home/www_maintainer/public_html/cgi-bin/application2/app2.cgi /home/www_maintainer/public_html/cgi-bin/application2/app2helper.cgi /home/www_maintainer/tools/gnuplot/gnuplot /home/www_maintainer/tools/python/python -&gt; python2.6 /home/www_maintainer/tools/python/python2.6 /home/www_maintainer/tools/python/python2.6-config </code></pre> <p>Then in your CGI files, make sure that the paths to the <code>tools</code> are set correctly as needed. It is <em>not</em> necessary for web users to access those tools directly, so keep those out of access. If you're doing <code>python</code> via CGI (which I assume, in this case), make sure your shebang line shows the correct path; <code>#!/home/www_maintainer/tools/python/python</code>, for example.</p> <hr> <p><strong>Original answer:</strong></p> <p>What a lot of applications do, such as the ones distributed with Debian, is put their applications in the <code>/usr/share/lib/programname</code> directory and then use an Apache <code>Alias</code> and <code>ScriptAlias</code> to map them to a base URL. This is how I used to run our own internally-developed applications as well and that worked very well.</p> <p>For your situation, I'd recommend changing as little as possible unless you plan to enhance the code or the system more and more over time. Making changes could bring headache if paths change, especially if any are bookmarked, unless you want to get cozy with some <code>mod_rewrite</code> in your config.</p> <p>Do you have any specific examples that I could use to demonstrate what I've described?</p> <p>Also, with regard to ancient <code>/usr/bin/python</code>, is your system completely up-to-date? Or is the problem that your Linux distribution just doesn't push a newer version? I'd avoid installing a version of Python that isn't managed by your distro's package management system.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload