Jump to content

How To Set Index.py/.cgi As Default Index


Recommended Posts

hi all,

 

guys i have johny version with python, i was wondering how to set up an index(.py) file for my website that is placed in my /cgi-bin/ folder so i can access my index page without typing the full path/address such as mywebsite.heliohost.org/cgi-bin/index.cgi?

 

what i could find on the web is that i can use redirection from www/index.html to www/cgi-bin/index.py or permit apache exec cgi in www.

 

so what can i use in this case and how do i do that?.

 

any help appreciated.

tnx.

Link to comment
Share on other sites

The index.html way is really easy. Create public_html/index.html

<meta http-equiv="refresh" content="0; url=cgi-bin/index.py" />
With this option people who go to domain.heliohost.org will end up at domain.heliohost.org/cgi-bin/index.py

 

Making python scripts executable in public_html is a little more complicated. Create public_html/.htaccess

# this line makes the python code execute instead of display the source
AddHandler cgi-script .py

# this line executes index.py if no file is specified
DirectoryIndex index.py
With this option people who do to domain.heliohost.org will see that in their browser url bar.
  • Like 1
Link to comment
Share on other sites

The index.html way is really easy. Create public_html/index.html

<meta http-equiv="refresh" content="0; url=cgi-bin/index.py" />
With this option people who go to domain.heliohost.org will end up at domain.heliohost.org/cgi-bin/index.py

 

Making python scripts executable in public_html is a little more complicated. Create public_html/.htaccess

# this line makes the python code execute instead of display the source
AddHandler cgi-script .py

# this line executes index.py if no file is specified
DirectoryIndex index.py
With this option people who do to domain.heliohost.org will see that in their browser url bar.

 

that is really fast reply, thank you,

 

i tried to upload and create .htaccess in html_public folder and i got 500 internal error but, i succeded to upload it to www folder, also i noticed that www folder has 777 permission and html 750 permission may be that was the reason.

 

anyway when i try to visit mydomain.heliohost.org i get 500 internal error:

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@konroor.heliohost.org and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

 

so i think server reads the script but still got no permissions to execute it?

 

also the .htaccess it self in www or public_html forlder is invisible, .

 

oh i fogot to mention, as yu suggested my .htaccess has 2 instructions,

 

AddHandler cgi-script .py

DirectoryIndex index.py

 

 

any suggestions on how to solve this

Link to comment
Share on other sites

You've actually got all the permissions correct and files created properly and everything. Very impressive! The 500 error is because the python module webob isn't installed.

 

i noticed that www folder has 777 permission and html 750 permission may be that was the reason.

www is actually a symlink to public_html, and symlinks always have 777 permissions.
Link to comment
Share on other sites

You've actually got all the permissions correct and files created properly and everything. Very impressive! The 500 error is because the python module webob isn't installed.

 

i noticed that www folder has 777 permission and html 750 permission may be that was the reason.

www is actually a symlink to public_html, and symlinks always have 777 permissions.

 

ok, i understand, is there a way to get the module webob running? if there is, than please let me know what i can do from my side? Or otherwise it is a good idea to use redirecting method?))

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...