Advertisement
Victoralm

nGinx + php7.0-fpm on Ubuntu 16.04 setup

Jun 18th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.51 KB | None | 0 0
  1. # nginx.conf starts
  2. user  www-data;
  3. worker_processes  1;
  4.  
  5. error_log  /var/log/nginx/error.log warn;
  6. pid        /var/run/nginx.pid;
  7.  
  8.  
  9. events {
  10.     worker_connections  256;
  11. }
  12.  
  13.  
  14. http {
  15.     #
  16.     tcp_nopush on;
  17.     #
  18.     tcp_nodelay on;
  19.     #
  20.     types_hash_max_size 2048;
  21.     #
  22.     server_tokens off;
  23.     #
  24.     client_max_body_size 8m;
  25.     #
  26.     reset_timedout_connection on;
  27.     #
  28.     # server_names_hash_bucket_size 64;
  29.     #
  30.     # server_name_in_redirect off;
  31.    
  32.     index index.php index.html index.htm;
  33.    
  34.     include       /etc/nginx/mime.types;
  35.     default_type  application/octet-stream;
  36.  
  37.     log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
  38.                       '$status $body_bytes_sent "$http_referer" '
  39.                       '"$http_user_agent" "$http_x_forwarded_for"';
  40.  
  41.     access_log  /var/log/nginx/access.log  combined;
  42.     error_log /var/log/nginx/error.log;
  43.  
  44.     sendfile        on;
  45.     #tcp_nopush     on;
  46.  
  47.     keepalive_timeout  65;
  48.  
  49.     gzip on;
  50.     gzip_disable "msie6";
  51.     gzip_vary on;
  52.     gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
  53.    
  54.     upstream php7-fpm {
  55.       keepalive 8;
  56.       server unix:/var/run/php/php7.0-fpm.sock;
  57.     }
  58.  
  59.     # include /etc/nginx/conf.d/*.conf;
  60.     include /etc/nginx/sites-enabled/*;
  61. }
  62. # nginx.conf ends
  63.  
  64. # generic server starts
  65. server {
  66.   listen 80;
  67.  
  68.   server_name awebpage.com;
  69.  
  70.   root /absolute/path/to/the/files/;
  71.   index index.php index.html index.htm;
  72.  
  73.   access_log /absolute/path/to/the/files/awebpage-access.log combined;
  74.   error_log /absolute/path/to/the/files/awebpage-error.log;
  75.  
  76.   location /. { ## Disable access to .htaccess and other hidden files
  77.     return 404;
  78.   }
  79.  
  80. #  location / { ## Demands a user and password before enable access to the page
  81. #    try_files $uri $uri/ /rampage.php?$args;
  82. #    auth_basic "Restricted";
  83. #    auth_basic_user_file  /home/stoporose/meussites/victoralm.com/webalizer/.htpasswd;
  84. #    autoindex on;
  85. #  }
  86.  
  87.   location ~ \.php$ {
  88.     fastcgi_split_path_info ^(.+\.php)(/.+)$;
  89.     fastcgi_param PATH_INFO $fastcgi_path_info;
  90.     #fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
  91.     fastcgi_param PHP_VALUE "cgi.fix_pathinfo=1";
  92.     fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
  93.     fastcgi_index index.php;
  94.     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  95.     include fastcgi_params;
  96.   }
  97.  
  98. }
  99. # generic server ends
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement