# is an example of a site configuration file for nginx
# rename and place this file in the folder "/etc/nginx/sites-available"
# and make the necessary changes
# to enable site, use the following command:
# sudo ln -s /etc/nginx/sites-available/yourFileName /etc/nginx/sites-enabled/yourFileName
server {
  # your domain here
  server_name panel.example.org;
  # default path, but you can use own
  root /usr/share/ssa-webpanel/www;
  
  server_tokens off;
  add_header X-Frame-Options SAMEORIGIN;
  
  # be sure to restrict access to your panel
  # remove comments and create .htpasswd file
  # auth_basic "Control panel";
  # auth_basic_user_file /usr/share/ssa-webpanel/.htpasswd;
  # to create .htpasswd use the following command:
  # sudo htpasswd -dcb /usr/share/ssa-webpanel/.htpasswd usersnameToAccess userPassword
  # note: use arguments -db (without c) to add new users to existing file:
  # sudo htpasswd -db /usr/share/ssa-webpanel/.htpasswd otherUser password
  # logs do not disable
  error_log /var/log/nginx/error.log;
  access_log /var/log/nginx/access.log;
  # additionally, you can restrict access by IP
  # allow 192.168.0.1; # allow IP
  # deny all; # deny for all
  location / {
    index index.php index.html index.htm;
    try_files $uri $uri/ =404;
  }
  # phpMyAdmin
  location /phpmyadmin {
    alias /usr/share/phpmyadmin;
    index index.php index.html index.htm;
    
    location ~ \.php$ {
      fastcgi_pass unix:/var/run/php5-fpm.sock;
      # fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      include fastcgi_params;
      fastcgi_param SCRIPT_FILENAME $request_filename;
      fastcgi_param PHP_ADMIN_VALUE "open_basedir=/usr/share/phpmyadmin:/usr/share/php/php-gettext";
      fastcgi_ignore_client_abort off;
    }
    
    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
      access_log    off;
      log_not_found off;
      expires       max;
    }
  }
  # phpPgAdmin
  location /phppgadmin {
    alias /usr/share/phppgadmin;
    index index.php index.html index.htm;
    
    location ~ \.php$ {
      fastcgi_pass unix:/var/run/php5-fpm.sock;
      # fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      include fastcgi_params;
      fastcgi_param SCRIPT_FILENAME $request_filename;
      fastcgi_param PHP_ADMIN_VALUE "open_basedir=none";
      fastcgi_ignore_client_abort off;
    }
    
    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
      access_log    off;
      log_not_found off;
      expires       max;
    }
  }
  location ~ \.php$ {
    fastcgi_pass  unix:/var/run/php5-fpm.sock;
    # fastcgi_pass  127.0.0.1:9000;
    fastcgi_index index.php;
    include       fastcgi_params;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_param PATH_INFO       $fastcgi_path_info;
    fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PHP_ADMIN_VALUE "open_basedir=/usr/share/ssa-webpanel/www";
  }
  location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
    expires max;
    log_not_found off;
  }
} 
  |