• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » Install Grav on Nginx : Modern, Flat File, PHP Powered CMS

By Abhishek Ghosh June 11, 2016 8:41 pm Updated on June 11, 2016

Install Grav on Nginx : Modern, Flat File, PHP Powered CMS

Advertisement

There are lot of PHP powered Static Website builders now. Grav is A Modern, Light, File-Based, PHP Powered CMS Suitable For Small Blog, Profile Website, Documentation, Official Website of Business. Here is How to Install Grav on Nginx on Ubuntu 16.04 LTS Cloud Server Instance. . This is also a self-reminder that Grav exists.

Install-Grav-on-Nginx---Modern,-Flat-File,-PHP-Powered-CMS

 

How to Install Grav on Nginx on Ubuntu 16.04 : Before We Begin

 

Grav has a built-in command-line interface (CLI) installed at bin/grav. This CLI is extremely useful for running day to day tasks such as updating, clearing cache, creating backups, and more. It is a Flat-File CMS – which makes database headache free. PHP is bad but PHP is the practical option in most of cases. One major reason of using WordPress is PHP. But WordPress is too heavy now. Making new WordPress installation lighter sucks a huge time. Basically, WordPress – Joomla – Drupal – Magento are the practical options. After Jekyll, OctoPress came; it became quite popular. But Ruby is not exactly easy to publish a post. We can not easily use the PHP functions directly. With Grav, we can see the created files with any FTP software like FileZilla or using Command Line File Browser. In other words – everything can be done from SSH, however there is a decent web GUI for the Admin part.

We are using the word CMS quite loosely. WordPress in strict sense is not a CMS but basically WordPress is also not only a blogging software.

Advertisement

---

 

 

This is GitHub Repository of Grav :

Vim
1
https://github.com/getgrav/

If you are running Nginx, then this is your normal webroot in deb based GNU/Linux :

Vim
1
/usr/share/nginx/html

If you are NOT running Nginx, then follow our Nginx-WordPress-Ubuntu 16.04 guide to Install only Nginx and PHP part.

Now, first cd to /usr/share/nginx/html and do these steps :

location = /usr/share/nginx/html
Vim
1
2
3
4
5
6
cd /usr/share/nginx/html
adduser grav
locate www.conf
## cd to the path of ..fpm/pool.d/
## where www.conf resides
nano grav.conf

Add the following :

location = grav.conf
Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
[grav]
 
user = grav
group = grav
listen = /var/php/php7.0-fpm.grav.sock;
listen.owner = www-data
listen.group = www-data
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chdir = /

This is an approximate default nginx configuration for Nginx, Ubuntu 16.04, PHP-FPM :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
server {
    listen 80 default_server;
    root /usr/share/nginx/html/grav;
    index index.html index.htm index.php;
    server_name localhost;
    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }
# for grav starts
location /user {
rewrite ^/user/accounts/(.*)$ /error redirect;
rewrite ^/user/config/(.*)$ /error redirect;
rewrite ^/user/(.*)\.(txt|md|html|php|yaml|json|twig|sh|bat)$ /error redirect;
}
location /cache {
rewrite ^/cache/(.*) /error redirect;
}
location /bin {
rewrite ^/bin/(.*)$ /error redirect;
}
location /system {
rewrite ^/system/(.*)$ /error redirect;
}
location /vendor {
rewrite ^/vendor/(.*)$ /error redirect;
}
access_log off;
        error_log  /var/log/nginx/grav-error.log error;
sendfile off;
# for grav ends
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        # fastcgi_pass unix:/run/php/php7.0-fpm.sock;
         fastcgi_pass unix:/var/php/php7.0-fpm.grav.sock;
        include fastcgi_params;
    }
## Begin - Security
    location ~* /(.git|cache|bin|logs|backups)/.*$ { return 403; }
    location ~* /(system|vendor)/.*\.(txt|xml|md|html|yaml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
    location ~* /user/.*\.(txt|md|yaml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
    location ~ /(LICENSE|composer.lock|composer.json|nginx.conf|web.config|htaccess.txt|\.htaccess) { return 403; }
## End - Security
 
}

To run the Grav CLI to create a new project, we need to go the webroot. We can change our username to grav.

location = /usr/share/nginx/html
Vim
1
2
3
4
5
6
7
cd /usr/share/nginx/html
git clone https://github.com/getgrav/grav.git
cd grav
su grav
bin/grav install
# example to install admin plugin
bin/gpm install admin

Admin will be at :

Vim
1
http://yoursite.com/admin

Here is Plugin and Grav CLI docs :

Vim
1
https://learn.getgrav.org/cli-console/grav-cli-plugin

They have another CLI tool :

Vim
1
https://learn.getgrav.org/cli-console/grav-cli-gpm

We need to add alias php="php-cli" in .bashrc. Restart the services :

Vim
1
2
sudo systemctl restart php7.0-fpm
service nginx restart

Install Grav on Nginx : Modern, Flat File, PHP Powered CMS

Tagged With flat file nginx , grav nginx alias , grav nginx Cache , grav on nginx , running grav php -S , small cms php nginx

This Article Has Been Shared 133 Times!

Facebook Twitter Pinterest
Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Install Grav on Nginx : Modern, Flat File, PHP Powered CMS

  • Cloud Gaming

    Cloud Gaming is offered via the Internet as streaming games which runs on external servers, audio and video are transferred to the client with little hardware.

  • Cloud Storage : Architecture and Technology

    Cloud Storage is a storage model based on networks, designed in the 1960s. Cloud storage services can be accessed by API or via web interface easy to all users.

  • Edge Computing : Basic Details

    Edge Computing is closely related to next generation Cloud Computing, Grid Computing, Private CDN and Elastic Computing and is deployed using load balancing.

  • Cloud Computing in the Past Year : Who Uses and Who Do Not

    Cloud Computing, has involved vendors such as Dell, EMC, HP and IBM and now facing a market that challenges them to innovate more towards cloud services.

  • Criteria for ERP SaaS Applications

    Criteria for ERP SaaS Applications should fit regardless of the chosen deployment model like on-premise, SaaS or hybrid, an ERP system should be functional.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (22.1K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • The Cost of Doing Business as a Handyman July 1, 2022
  • Samsung Galaxy S22 Ultra: Long Term Review June 30, 2022
  • How to Make the Most of Your S Pen (S22 Ultra) June 29, 2022
  • Safe Chargers for Samsung Galaxy S22 Ultra June 27, 2022
  • How Telecoms Can Use The Cloud To Power Their 5G Network June 24, 2022

About This Article

Cite this article as: Abhishek Ghosh, "Install Grav on Nginx : Modern, Flat File, PHP Powered CMS," in The Customize Windows, June 11, 2016, July 1, 2022, https://thecustomizewindows.com/2016/06/install-grav-on-nginx-modern-flat-file-php-powered-cms/.

Source:The Customize Windows, JiMA.in

This website uses cookies. If you do not want to allow us to use cookies and/or non-personalized Ads, kindly clear browser cookies after closing this webpage.

Read Privacy Policy.

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2022 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy