nginx ubuntu add rule for php but only to one directory — December 20, 2018

nginx ubuntu add rule for php but only to one directory

location ~ /anyDirectory/.*\.php$ {
    root        /www/anyDirectory;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
	fastcgi_index  index.php;
	fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
	include        fastcgi_params;

}

This is just an example. ‘fastcgi‘ settings can be different for your server. Added this so that you can get some idea.

location ~ /anyDirectory/.*\.php$ {}

This post saved my life.

Advertisements
Ubuntu Add SWAP memory — December 3, 2018
ubuntu get directory size — October 31, 2018
ubutnu 16 php enable module pecl http — October 30, 2018

ubutnu 16 php enable module pecl http

Tried so many things in last 2 days and I almost lost hope. But we can install it with a simple command.

sudo apt-get install php-pecl-http

followed so many conversation on stackoverflow about this topic and I was getting more and more errors.
1.https://askubuntu.com/questions/403327/install-pecl-packages-on-ubuntu
2.https://stackoverflow.com/questions/25892808/ubuntu-pecl-install-pecl-http-fail

but all thanks to this article on Installion.co.uk

ubuntu Nginx enable and disable vhost file — April 30, 2018

ubuntu Nginx enable and disable vhost file

Enable a vhost file:- We can do this by creating symbolic links from these files to the sites-enabled directory, which Nginx reads from during startup.
We can create these links by typing:

sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/

and restart nginx.

Disable a vhost file:-remove example.com file from /etc/nginx/sites-enabled/

and restart nginx.

Before restarting nginx you can always check if the configuration files has any error in it, You can do it with this command.

sudo nginx -t

Modify Your Local Hosts File if you want to access this URL

sudo nano /etc/hosts
127.0.0.1 example.com www.example.com

and restart nginx after making all changes

For better explanation read this link.

Ubuntu command to empty file —
Ubuntu SSH timeout — April 16, 2018