• 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 863 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 (24.3K 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

  • Is it Good to Run Apache Web server and MySQL Database on Separate Cloud Servers? March 27, 2023
  • Advantages of Cloud Server Over Dedicated Server for Hosting WordPress March 26, 2023
  • Get Audiophile-Grade Music on Your Smartphone March 25, 2023
  • Simple Windows Security and Privacy Checklist for 2023 March 24, 2023
  • 7 Best Artificial Intelligence (AI) Software March 24, 2023

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, March 28, 2023, https://thecustomizewindows.com/2016/06/install-grav-on-nginx-modern-flat-file-php-powered-cms/.

Source:The Customize Windows, JiMA.in

PC users can consult Corrine Chorney for Security.

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

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

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

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT