Skip to content

Instantly share code, notes, and snippets.

@ilhamarrouf
Last active August 25, 2019 18:03
Show Gist options
  • Select an option

  • Save ilhamarrouf/f609ba54c0002415060b8178b3b00583 to your computer and use it in GitHub Desktop.

Select an option

Save ilhamarrouf/f609ba54c0002415060b8178b3b00583 to your computer and use it in GitHub Desktop.
example virtual host php
server {
listen 80;
server_name example.com;
index index.php;
root /path/to/public;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ \.php {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
}
}
server {
listen 8001;
server_name example2.com;
index index.html;
root /path/to/public;
location / {
try_files $uri /index.html$is_args$args;
}
location ~ \.html {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.html)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_index index.html;
fastcgi_pass 127.0.0.1:9000;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment