Skip to content

Instantly share code, notes, and snippets.

@cse031sust02
Last active December 14, 2016 06:33
Show Gist options
  • Save cse031sust02/7eeb1168ab2f13d60ccc176034393ae6 to your computer and use it in GitHub Desktop.
Save cse031sust02/7eeb1168ab2f13d60ccc176034393ae6 to your computer and use it in GitHub Desktop.
☐ Start
- sudo apt-get update
☐ Install nginx
- sudo apt-get install nginx
☐ Install PHP (PHP7)
- sudo add-apt-repository ppa:ondrej/php
- sudo apt-get update
- sudo apt-get install php7.0 php7.0-fpm php7.0-mysql php7.0-cli php7.0-mbstring -y
* change cgi.fix_pathinfo
- sudo nano /etc/php/7.0/fpm/php.ini
set cgi.fix_pathinfo=0;
☐ configure php7 with nginx
- sudo nano /etc/nginx/sites-available/default
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/html;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
try_files $uri $uri/ =404;
}
# Pass all .php files onto a php-fpm/php-fcgi server.
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
☐ Install mysql
- sudo apt-get install mysql-server
- sudo mysql_secure_installation
Q. Why secure_installation?
A. http://dev.mysql.com/doc/refman/5.6/en/mysql-secure-installation.html
☐ Install phpmyadmin
- sudo apt-get install phpmyadmin
- ln -s /usr/share/phpmyadmin /var/www/html
- sudo nano /etc/nginx/sites-available/default
Add Thes Lines :
location /phpmyadmin {
root /var/www/html;
index index.php;
try_files $uri $uri/ =404;
location ~ ^/phpmyadmin/(doc|sql|setup)/ {
deny all;
}
location ~ /phpmyadmin/(.+\.php)$ {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
* If you are not using any password and try to login to phpmyadmin, you will see a error message
'Login without a password is forbidden by configuration (see AllowNoPassword)'
To Fix that,
- sudo nano /etc/phpmyadmin/config.inc.php
find line,
// $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
uncomment that line.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment