Advertisement
niammuddin

contoh file konfigurasi nginx pada virtualhost domain

Jan 1st, 2014
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. server {
  2. listen 80;
  3. #listen [::]:80 default_server ipv6only=on;
  4. root /usr/share/nginx/html/pendidikan123.com/public_html;
  5. index index.php index.html index.htm;
  6. server_name www.pendidikan123.com pendidikan123.com;
  7.  
  8. location / {
  9. # First attempt to serve request as file, then
  10. # as directory, then fall back to displaying a 404.
  11. try_files $uri $uri/ /index.php;
  12. # Uncomment to enable naxsi on this location
  13. # include /etc/nginx/naxsi.rules
  14. }
  15.  
  16. location ~* \.html$ {
  17. expires -1;
  18. }
  19. location ~* \.(css|js|gif|jpe?g|png)$ {
  20. expires 168h;
  21. add_header Pragma public;
  22. add_header Cache-Control "public, must-revalidate, proxy-revalidate";
  23. }
  24.  
  25. location /doc/ {
  26. alias /usr/share/doc/;
  27. autoindex on;
  28. allow 127.0.0.1;
  29. allow ::1;
  30. deny all;
  31. }
  32.  
  33. # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
  34. #location /RequestDenied {
  35. # proxy_pass http://127.0.0.1:8080;
  36. #}
  37.  
  38. #error_page 404 /404.html;
  39.  
  40. # redirect server error pages to the static page /50x.html
  41. #
  42. #error_page 500 502 503 504 /50x.html;
  43. #location = /50x.html {
  44. # root /usr/share/nginx/html;
  45. #}
  46.  
  47. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  48. #
  49. location ~ \.php$ {
  50. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  51. # # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
  52. #
  53. # # With php5-cgi alone:
  54. # fastcgi_pass 127.0.0.1:9000;
  55. # # With php5-fpm:
  56. fastcgi_pass unix:/var/run/php5-fpm.sock;
  57. fastcgi_index index.php;
  58. include fastcgi_params;
  59. }
  60.  
  61. # deny access to .htaccess files, if Apache's document root
  62. # concurs with nginx's one
  63. #
  64. #location ~ /\.ht {
  65. # deny all;
  66. #}
  67. }
  68.  
  69.  
  70. # another virtual host using mix of IP-, name-, and port-based configuration
  71. #
  72. #server {
  73. # listen 8000;
  74. # listen somename:8080;
  75. # server_name somename alias another.alias;
  76. # root html;
  77. # index index.html index.htm;
  78. #
  79. # location / {
  80. # try_files $uri $uri/ =404;
  81. # }
  82. #}
  83.  
  84.  
  85. # HTTPS server
  86. #
  87. #server {
  88. # listen 443;
  89. # server_name localhost;
  90. #
  91. # root html;
  92. # index index.html index.htm;
  93. #
  94. # ssl on;
  95. # ssl_certificate cert.pem;
  96. # ssl_certificate_key cert.key;
  97. #
  98. # ssl_session_timeout 5m;
  99. #
  100. # ssl_protocols SSLv3 TLSv1;
  101. # ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
  102. # ssl_prefer_server_ciphers on;
  103. #
  104. # location / {
  105. # try_files $uri $uri/ =404;
  106. # }
  107. #}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement