nginx_conf 825 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. # This file a part of SHM. Copyright (C) Tom Li 2013.
  3. # License: LGPL version 3 or later.
  4. USERNAME=$1
  5. DOMAIN=$2
  6. args=("$@")
  7. for ((i=2; i<$#; i++))
  8. do
  9. arg=${args[$i]}
  10. DOMAINS="${DOMAINS} ${arg}"
  11. done
  12. read -r -d '' CONF << EOF
  13. server {
  14. server_name ${DOMAIN} www.${DOMAIN}${DOMAINS};
  15. listen 106.187.38.29;
  16. root /home/${USERNAME}/web;
  17. index index.html index.htm index.php;
  18. access_log /var/log/virtualhost/${DOMAIN}_access_log;
  19. error_log /var/log/virtualhost/${DOMAIN}_error_log;
  20. include /etc/nginx/fastcgi_params;
  21. fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
  22. #include /etc/nginx/wordpress.conf;
  23. location ~ \.php$ {
  24. try_files \$uri =404;
  25. fastcgi_pass unix:/var/run/virtualhost/php-${DOMAIN}.sock;
  26. }
  27. }
  28. EOF
  29. echo "$CONF"