Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have just bought a dedicated server and they provide me a IP address, access info as root and machive with Centos 5.

I would like to serve my django app in that machine but because I have no experiences such server issues I don't know what is the best way to do that.

I have install mysql, python 2.7.1 and django as root and I think this is reasonable. But I have questions know.

  1. Should I create a new user to deploy application and serve it on paache or doing that as root also ok ?
  2. Should I create a user to manipulate with mysql ?
  3. Django is running with Apache-modwsgi in my local. Should I configure Apache on server to run with mod-wsgi or is there any better method to it ?

I am a newbie on this server issues so please forgive me if my questions are so general to answer.

Any easy-to-read document (beginner-inter level) is also ok for me. I am also really appreciated if you explain your experiences or the best practices to do such configurations.

share|improve this question
    
On CentOS Apache runs as the user "apache" and group "apache" by default (provided you installed it from the CentOS-Base repo). –  HTTP500 Jul 13 '11 at 21:25
add comment

migrated from stackoverflow.com Jul 13 '11 at 21:13

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 4 down vote accepted
  1. don't run it as root, it is a safety risk
  2. make a seperate user for mysql that only has the rights it needs, you can even make different ones : (if you only need to read for certain users only give that user read rights)

  3. http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide

  4. install a firewall, close everything and open each port you need. I suggest you take a look at "vuurmuur" if you want something simple

for your user you do as root :

  1. adduser someuser
  2. mkdir /var/www/somedir
  3. mkdir /home/someuser/dirwherethesourcecango
  4. ln -s /var/www/somedir /home/someuser/dirwherethesourcecango (symbolic link)
  5. chown -R someuser /var/www/somedir (set the rights so you can write)

Now when you log in as someuser, you can just add files to the dirwherethesourcecango, it is a symbolic link to /var/www/somedir.

share|improve this answer
    
Thanks for your detailed answer but I still have some confusion on users. For example, where should I put the source code of my app ? Because I have just used VPS, there was a public_html folder,symlink to www folder and soon. In this case, should I define a user and make a symlink to /usr/local/www/ from /home/username/ ? Could you illustrate the tree I must have ? –  brsbilgic Jul 13 '11 at 23:29
    
I'll add it to my answer –  Lucas Kauffman Jul 14 '11 at 4:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.