diff --git a/Nginx-configuration-instead-of-the-default-lighttpd-and-php-cgi-option.asciidoc b/Nginx-configuration-instead-of-the-default-lighttpd-and-php-cgi-option.asciidoc new file mode 100644 index 0000000..d9b55f7 --- /dev/null +++ b/Nginx-configuration-instead-of-the-default-lighttpd-and-php-cgi-option.asciidoc @@ -0,0 +1,33 @@ +. apt-get -y install nginx php5-fpm apache2-utils #install necessary packages +. systemctl disable lighttpd #disable lighttpd at startup +. systemctl enable php5-fpm #enable php5-fpm at startup +. systemctl enable nginx #enable nginx at startup +. edit /etc/nginx/conf.d/default to: +---- +server { + listen 80 default_server; + listen [::]:80 default_server; + root /var/www/html; + index index.html index.htm index.php; + server_name _; + autoindex off; + location / { + expires max; + return 204 'pixel'; + } + location /admin{ + root /var/www/html; + index index.php; + auth_basic "Restricted"; #For Basic Auth + auth_basic_user_file /etc/nginx/.htpasswd; #For Basic Auth + } + location ~ \.php$ { + include snippets/fastcgi-php.conf; + fastcgi_pass unix:/var/run/php5-fpm.sock; + } +} +---- +. htpasswd -c /etc/nginx/.htpasswd exampleuser #create username for authentication for the admin - we don't want other people in our network change our black and whitelist ;) +. service lighttpd stop #stop default lighttpd +. service php5-fpm start #start php5-fpm daemon +. service nginx start #start nginx webserver \ No newline at end of file