Forum Moderators: phranque

Message Too Old, No Replies

Launching a website from user directory with server blocking .htaccess

         

ZombieX

2:06 am on Sep 28, 2011 (gmt 0)

10+ Year Member



Hello All,

I am fairly new to web development, so I apologize in advance. I have an assignment which requires me to deploy a database backed web application on a university server. I have written the web application on my workstation so I am not asking for homework help.

What I am trying to figure out is, how do I serve this website on my departments server under a local user directory?

My original thought was to include a .htaccess file in my submission, which allowed the execution of .py scripts from that directory. After getting the 403 Forbidden error while trying to serve a simple test site, I uncovered that the department's httpd.conf file is blocking .htaccess files in user directories.

My second thought was to bundle apache2 in my submission, launch an instance of apache from the local directory, listening on a specific port (i.e. 8080). After the session is over, round up all apache instances launched as user and kill them. Is this a bad idea?

If there is a better way, I welcome the suggestions.

Thank you in advance.

lucy24

3:10 am on Sep 28, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It never hurts to go to the People In Charge and ask nicely if they can make an exception for you. At worst, they'll say no.

OK. At worst, they'll say no with a whole bunch of appended adjectives directed at your intelligence, your lineage, your physical appearance and so on. Ignore them; it comes with the job.

By "assignment" do you mean "class assignment"? If so, there should be a cluster of people with similar needs. This in turn means that it should be OK to route your question via the professor. He/she in turn will either hand down a universal ruling-- "No htaccess involvement!"-- or talk to the People In Charge so you don't have to.

ZombieX

3:24 am on Sep 28, 2011 (gmt 0)

10+ Year Member



So I have been talking with some classmates, and we have come to a conclusion that we could launch a separate instance of apache within our submission directories and by using the -f switch, specify an alternate httpd.conf for that directory, which allows cgi execution, etc.

Guess we will have to test and see. Worst case, IT locks my account.

lucy24

4:25 am on Sep 28, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Worst case, IT locks my account.

That's where talking to the professor helps. They can hardly lock you out for doing a class assignment with professorial approval :) Unless, ahem, the assignment was to find three different ways to hack into the administration's Discretionary Fund database.

ZombieX

3:47 am on Sep 29, 2011 (gmt 0)

10+ Year Member



OK, so I am getting nowhere with this. Can someone help? What I am trying to do is upload a file (mysite) to my local directory on a unix server. mysite contains three files, let's call them mysite.py, module1.py, module2.py.

Apache is running on this server, .htaccess files are not blocked (I cant find AllowOveride None in httpd.conf) and mod_python.so is loaded.

What do I need to configure so that I can enter the url:

www.theunixserver/~my_directory/mysite/mysite.py/start and have my session serve? I keep getting the 403 Forbidden.

Thank you.

lucy24

4:52 am on Sep 29, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Honestly, I think you're asking the wrong people. Unless figuring out how to get in is, itself, part of the assigment. In which case you shouldn't be asking at all ;)

Are you stuck on uploading the files in the first place, or in accessing files that you have successfully uploaded?

Where are you getting the url? Is it what you were told to use, or what you want to use? Have you ever used ~my_directory before? You can't just waltz in and create a directory in someone else's server.

When the problem involves a server that doesn't belong to you-- but that you have permission to use, at least in some limited way-- you generally need to ask the person who does own the server. Or, equivalently, read that 15-page handout they gave you on the first day of class and you tossed it aside for later. There may be a magic word you have to use. Or an extra / that you need to type in.

ZombieX

12:19 pm on Sep 29, 2011 (gmt 0)

10+ Year Member



I can upload successfully, and I can serve static pages from /~my_directory/public_html/ just fine. My assumption is that from a browser, I should be able to go to www.theuniversitysserver/~my_directory/public_html/mysite/mysite.py and it should serve the startpage from my project.

I have put a .htaccess file in that directory, setting the handler to mod_python,... but I keep getting Forbidden.

I thought it had something to do with directory browsing on the server so I anchored a link on my index.html page to the project but I still get the Forbidden error.

lucy24

9:05 pm on Sep 29, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You can do a lot with htaccess, but you can't de-forbid something that has been forbidden further up the line. Well, with the narrow exception of auto-indexing (Options +Indexes), which normally serves up a 403 if a human tries to snoop in an indexless directory.

My assumption is that from a browser, I should be able to go to
www.theuniversitysserver/~my_directory/public_html/mysite/mysite.py
and it should serve the startpage from my project.

This by itself may or may not be true. See any post from g1smd in this Forum about the difference between paths (where a file "really" lives) and urls (what you type to get there). But given

I can serve static pages from /~my_directory/public_html/ just fine.

you should be right. Does it still work if you go one more step, to
www.theuniversitysserver/~my_directory/public_html/mysite/
and put a regular static page at that level? Or simply an htaccess that allows auto-indexing? (If the directory is otherwise empty, you'll get a single line pointing to "parent directory".)