Here is quickstep to configure a new server in Softlayer for Django and PHP development environtment.
1 2 | sudo apt-get update && sudo apt-get upgrade sudo apt-get install libpq-dev python-dev python-software-properties postgresql postgresql-contrib nginx git zip unzip build-essential python nmap libxslt1-dev python-pip imagemagick uwsgi uwsgi-plugin-python nmap mysql-server phpmyadmin libffi-dev libmysqlclient-dev libmysqlclient-dev libmysqlclient18 |
For Django sites-enables/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | server { listen 80; server_name www.yourdomain.com; return 301 $scheme://yourdomain.com$request_uri; } server { listen 80; server_name yourdomain.com; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; root /var/yourdomain; client_max_body_size 30m; index index.php index.html index.htm; # Check if a file exists at /var/www/domain/ for the incoming request. # If it doesn’t proxy to Apache/Django. try_files $uri @django; location /media { alias /var/yourdomain/media; } location /static { alias /var/yourdomain/static; } location / { uwsgi_pass unix:/tmp/yourdomain.sock; uwsgi_read_timeout 600000; include uwsgi_params; } } |
For WordPress configuration:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | server { listen 80; server_name www.yourdomain.com; root /var/yourdomain.com; client_body_timeout 460; client_header_timeout 460; send_timeout 460; client_max_body_size 10m; keepalive_timeout 300 300; access_log /var/log/nginx/access.log; index index.php index.html index.htm; location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } location / { # This is cool because no php is touched for static content try_files $uri $uri/ /index.php?$args; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ .php$ { fastcgi_send_timeout 3800; fastcgi_read_timeout 3800; fastcgi_connect_timeout 2800; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~* .(js|css|png|jpg|jpeg|gif|ico)$ { expires max; log_not_found off; } # deny access to .htaccess files, if Apache document root # concurs with nginx one # location ~ /.ht { deny all; } } |