• 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 » Nginx Config Syntax Highlighting in Nano (Ubuntu)

By Abhishek Ghosh January 22, 2015 9:29 am Updated on January 22, 2015

Nginx Config Syntax Highlighting in Nano (Ubuntu)

Advertisement

Normally, People Will Use SSH to Edit the Nginx Configuration Files. Here is How to Get Nginx Config Syntax Highlighting in Nano on Ubuntu. First, we are describing the method for localhost, so that one can test and edit the rc files, in other two subheads, we will describe how to enable Nginx config Syntax Highlighting in Nano on Ubuntu Server and what are problems of Syntax Highlighting in Nano. By any means, DO NOT MAKE NANO THE DEFAULT TEXT EDITOR. Using Vi is not so difficult – open the file with command like vi /etc/nginx/nginx.conf and press i to edit. Edit it and press escape. Then type :w to write out and :q to exit.

 

Nginx Config Syntax Highlighting in Nano : OS X localhost

 

Apple keeps the Nano in 2.0.x version. Homebrew-dupes do not upgrade Nano anymore, why all do not like Nano to get upgraded will be discussed later. You can follow our guide to upgrade Nano in OS X in the guide for OS X Nano Syntax Highlighting. Only add this flag while building :

Vim
1
--enable-nanorc

Do not follow rest of the guide. Now, do these steps :

Advertisement

---

Vim
1
2
3
4
cd ~ && git clone https://github.com/AbhishekGhosh/nano-syntax-highlighting-iNano-.git
cd nano-syntax* && sudo make install-global TEXT=white
vi /etc/nanorc
# nano ~/.nanorc

That /etc/nanorc is a read only file unless you use --enable-nanorc during building it. If you add ~/.nanorc, it might create problem. Paste this line on either /etc/nanorc (ideally) or in ~/.nanorc (create it, it will not be present by default) :

Vim
1
include "/usr/local/share/nano/ALL.nanorc"

You will get Syntax highlighting more than default. This is my current repo on GitHub for Nanorc. Star the repo, I will update it. When I will update, you’ll also update again.
Test any file on your computer including Nginx Files.

Without the flag, adding the line on /etc/nanorc, will not work.

 

Nginx Config Syntax Highlighting in Nano : Ubuntu Server

 

Nano is already in updated version. Be you are a user or the root, does not matter, the commands are same :

Vim
1
2
3
cd ~ && git clone https://github.com/AbhishekGhosh/nano-syntax-highlighting-iNano-.git
cd nano-syntax* && sudo make install-global TEXT=white
vi ~/.nanorc

As that /etc/nanorc is a read only file unless we have not got the chance to build Nano with --enable-nanorc flag, we have no other way than using ~/.nanorc. Paste this line on ~/.nanorc (create it, it will not be present by default) :

Vim
1
include "/usr/local/share/nano/ALL.nanorc"

Open any nginx file with nano like /etc/nginx/sites-available/default or /etc/nginx/nginx.conf. Getting color? If you do not get color, that is for so many commented out stuffs on default, remove them, you’ll get color.

Nginx Config Syntax Highlighting in Nano (Ubuntu)

 

Why Syntax Highlighting in Nano is Disabled By Default?

 

Nano’s syntax highlighting is kept to off to avoid segmentation error. Apple probably does not upgrade Nano out of fear. Maybe, Homebrew-dupes discontinued for the same reasons. We have some collection of nanorc files – on the Github repo, the script concatenates all the files to one; you will not need to add so much lines. We are including in this way :

include /usr/local/share/nano/ALL.nanorc

If you know more .nanorc, you can send a pull request to add.

We use .zshrc on all my Macs, MacBooks with export PATH=/usr/local/bin:$PATH on both .zshrc and .bash_profile. As Nano is not the system default text editor, unlike vi, there is no fear, you can build the latest version.

Our .bash_profile has that only one line. There is no .bashrc. It is impractical to comment out so many includes on the fly.

When nano will throw segmentation error, then the way is to use vi to open it with sudo vi ~/.nanorc in Terminal (not iTerm2) and commenting out that line to solve the segmentation error.

When Nano was ported from Pico – http://www.washington.edu/pine/getpine/ , then it had another name. Again it was re-written with the Nano name. At anytime, Nano can throw segmentation error if you are using Syntax Highlighting. Nano supports both nanorc and .nanorc, even nanor.c. The files can be kept at /usr/share/nano or at $HOME or /etc either as nanorc or .nanorc. That segmentation fault or segmentation error can happen occur under some of these circumstances:

A buggy program
Try to access an array beyond the end of an array under C programming language
Missing config file or /dev/ inside a chrooted jail in shared libs
Hardware is faulty
Memory or driver is faulty
Overheating

So much is not said, only people says – “Vi is powerful editor”. Powerful means, it will not throw abnormal errors. Chance of error increases if you use Syntax Highlighting in Nano.

Tagged With edit nginx config ubuntu , ubuntu gedit nginx config highlight mode , nginx syntax , nginx configuration edit with nano , nano segfault using nanorc , nano nginixconf sytax , nano editor nginx , nano config , how to use nano to edit nginx in linux , what to edit in the nginx config to enable usage for organizer on windows
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 Nginx Config Syntax Highlighting in Nano (Ubuntu)

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • OS X Nano Syntax Highlighting

    Here is How to Update OS X Nano and Enable OS X Nano Syntax Highlighting For Various Languages. Needed dot Files to Match With iTerm2 Has Been Supplied.

  • Nano Syntax Highlighting : nanorc

    Nano Syntax Highlighting Can Be Forced With nanorc Files on All Linux Distro Like Ubuntu, CentOS, REHL, Arch Linux As Well As on OS X & BSD.

  • WordPress Multisite on Nginx on Ubuntu 14.04 on HP Cloud

    Here is a Step by Step Guide on Setting Up WordPress Multisite on Nginx on Ubuntu 14.04 on HP Cloud with All Commands and the Configuration.

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

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
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