server { # listen 443; listen 80; server_name www.mydomain.com; root /usr/share/nginx/www; index index.php; #SSL Configuration #ssl on; #ssl_certificate /etc/ssl/ssl.crt; #ssl_certificate_key /etc/ssl/ssl.key; #ssl_protocols SSLv3 TLSv1; #ssl_ciphers ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM; #ssl_session_cache shared:SSL:15m; #ssl_session_timeout 15m; #ssl_verify_depth 3; location / { try_files $uri $uri/ /index.php?q=$uri&$args; #SEF URL } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ \.php$ { fastcgi_pass localhost:9000; fastcgi_index index.php; #fastcgi_param HTTPS on; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # deny running scripts inside writable directories location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ { return 403; error_page 403 /403_error.html; } # caching of files location ~* \.(ico|pdf|flv)$ { expires 1y; } location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ { expires 15d; } } server { server_name mydomain.com; listen 80; return 301 http://www.mydomain.com$request_uri; }