From 3bcb8c47e4c8ac9a7bc55e1486ccb6b402e50bfb Mon Sep 17 00:00:00 2001 From: sim2github Date: Thu, 1 May 2014 21:11:38 +0300 Subject: [PATCH] OpenServer NginX usage --- Nginx-1.5.12_vhost.conf | 89 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 Nginx-1.5.12_vhost.conf diff --git a/Nginx-1.5.12_vhost.conf b/Nginx-1.5.12_vhost.conf new file mode 100644 index 0000000..cb3a15a --- /dev/null +++ b/Nginx-1.5.12_vhost.conf @@ -0,0 +1,89 @@ +#---------------------------------------------# +# +#---------------------------------------------# + +server { +listen %ip%:%httpport%; +listen %ip%:%httpsport% ssl; +server_name %host% %aliases%; +#if ($request_method !~* ^(GET|HEAD|POST)$ ){return 403;} +%limit% + +root "%hostdir%"; +index index.php index.html; + +location ~* \.(js|css|less|png|jpg|jpeg|gif|ico|woff|ttf|svg|tpl)$ { + expires 24h; + access_log off; +} + +location = /favicon.ico { + log_not_found off; + access_log off; +} + +location = /robots.txt { + log_not_found off; + access_log off; +} + +location ~ /\. { + # deny all; + access_log off; + log_not_found off; +} + +location / { + if (!-e $request_filename){ + rewrite ^/(.*)$ /index.php?qs=$1 last; + } +} + +location /cms/ { + rewrite ^/(.*)$ /cms/index.php?qs=$1 last; +} + +location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ { + try_files $uri =404; +} + +location ~ \.php$ { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + # if (!-e $document_root$document_uri){return 404;} + fastcgi_pass backend; + fastcgi_index index.php; + fastcgi_param TMP "%sprogdir%/userdata/temp"; + fastcgi_param TMPDIR "%sprogdir%/userdata/temp"; + fastcgi_param TEMP "%sprogdir%/userdata/temp"; + fastcgi_buffers 4 64k; + fastcgi_connect_timeout 1s; + fastcgi_ignore_client_abort off; + fastcgi_next_upstream timeout; + fastcgi_read_timeout 30s; + fastcgi_send_timeout 30s; + fastcgi_param CONTENT_TYPE $content_type; + fastcgi_param CONTENT_LENGTH $content_length; + fastcgi_param DOCUMENT_URI $document_uri; + fastcgi_param DOCUMENT_ROOT $document_root; + fastcgi_param GATEWAY_INTERFACE CGI/1.1; + fastcgi_param HTTPS $https; + fastcgi_param QUERY_STRING $query_string; + fastcgi_param REQUEST_METHOD $request_method; + fastcgi_param REQUEST_URI $request_uri; + fastcgi_param REMOTE_ADDR $remote_addr; + fastcgi_param REMOTE_PORT $remote_port; + fastcgi_param SERVER_ADDR $server_addr; + fastcgi_param SERVER_PORT $server_port; + fastcgi_param SERVER_NAME $host; + fastcgi_param SERVER_PROTOCOL $server_protocol; + fastcgi_param SERVER_SOFTWARE nginx; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param SCRIPT_NAME $fastcgi_script_name; +} +# Íå óäàëÿéòå ñëåäóþùóþ ñòðîêó êîíôèãóðàöèè! +include "%sprogdir%/userdata/temp/config/%httpdriver%_url.conf"; +} + +#---------------------------------------------# +# Êîíåö øàáëîíà êîíôèãóðàöèè õîñòà +#---------------------------------------------#