mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
commit
235d81f544
@ -0,0 +1,121 @@
|
||||
How to Enable Multiple PHP-FPM Instances with Nginx / Apache
|
||||
================================================================================
|
||||
|
||||
PHP-FPM is also known as PHP FastCGI Process Manager. It is an advancement of PHP FastCGI implementation with more useful features for handling heavy-loaded servers and websites. Some of those features are listed below:
|
||||
|
||||
### New Features ###
|
||||
|
||||
- Advanced process managament capability with graceful start/stop options.
|
||||
- Ability to run the processes with different userids/groupids listening on different ports and using different PHP configurations.
|
||||
- Error logging.
|
||||
- Acceleration upload support
|
||||
- Special function to finish request and flush all data while doing some time consuming tasks
|
||||
- Both Dynamic and Static Child process Spawning
|
||||
- IP Address restriction
|
||||
|
||||
In this article, I'm going to discuss about installing PHP-FPM along with Nginx and Apache on a CentOS 7 server running cPanel 11.52 with EA3(EasyApache) and how to manage those installed multiple PHP-FPM instances via CPanel.
|
||||
|
||||
Before going to the installation procedures, let us take a look on the pre-requisites.
|
||||
|
||||
### Pre-requisites ###
|
||||
|
||||
1. Enable Mod_proxy_fcgi module
|
||||
2. Enable MPM_Event
|
||||
|
||||
Since, we are installing PHP-FPM on a EA3 server, we need to run EasyApache to compile Apache to enable these modules.
|
||||
|
||||
You can refer my previous document on how to install Nginx as reverse proxy on a Apache server to confirm with the Nginx installation.
|
||||
|
||||
I'll brief those installation steps once again here. You can refer to my previous documentation **(How to Set Nginx as Reverse Proxy on CentOS 7 /CPanel Server)** for details.
|
||||
|
||||
Step 1: Install the Epel repo
|
||||
Step 2: Install nDeploy RPM repo which is the most **IMPORTANT** step in this installation.
|
||||
Step 3: Install nDeploy and Nginx plugin using yum from the nDeploy repo.
|
||||
Step 4: Enable/Configure Nginx as reverse proxy
|
||||
|
||||
Once this is done, install the PHP-FPM packages for all PHP versions available in the server. EA3 uses remi repository for installing these packages. You can run this nDeploy script to download all packages.
|
||||
|
||||
root@server1 [~]# /opt/nDeploy/scripts/easy_php_setup.sh
|
||||
Loaded plugins: fastestmirror, tsflags, universal-hooks
|
||||
EA4 | 2.9 kB 00:00:00
|
||||
base | 3.6 kB 00:00:00
|
||||
epel/x86_64/metalink | 9.7 kB 00:00:00
|
||||
epel | 4.3 kB 00:00:00
|
||||
extras | 3.4 kB 00:00:00
|
||||
updates | 3.4 kB 00:00:00
|
||||
(1/2): epel/x86_64/updateinfo | 460 kB 00:00:00
|
||||
(2/2): epel/x86_64/primary_db
|
||||
|
||||
Running this script will install all these FPM packages for PHP 54, PHP 55, PHP 56 and PHP 70.
|
||||
|
||||
Installed Packages
|
||||
php54-php-fpm.x86_64 5.4.45-3.el7.remi @remi
|
||||
php55-php-fpm.x86_64 5.5.31-1.el7.remi @remi
|
||||
php56-php-fpm.x86_64 5.6.17-1.el7.remi @remi
|
||||
php70-php-fpm.x86_64 7.0.2-1.el7.remi @remi
|
||||
|
||||
After this installation, you need to enable PHP-FPM SAPI for Apache. You can run this script to enable PHP-FPM instances.
|
||||
|
||||
root@server1 [~]# /opt/nDeploy/scripts/apache_php-fpm_setup.sh enable
|
||||
mod_proxy_fcgi.c
|
||||
Please choose one default PHP version from the list below
|
||||
PHP70
|
||||
PHP56
|
||||
PHP54
|
||||
PHP55
|
||||
Provide the exact desired version string here and press ENTER: PHP54
|
||||
ConfGen:: lxblogger
|
||||
ConfGen:: blogr
|
||||
ConfGen:: saheetha
|
||||
ConfGen:: satest
|
||||
which: no cagefsctl in (/usr/local/jdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin)
|
||||
info [rebuildhttpdconf] Missing owner for domain server1.centos7-test.com, force lookup to root
|
||||
Built /usr/local/apache/conf/httpd.conf OK
|
||||
Waiting for “httpd” to restart gracefully …waiting for “httpd” to initialize ……
|
||||
…finished.
|
||||
|
||||
It will ask the required PHP version which you prefer to run as default on the server. You can enter those details and proceed to configure and generate the virtual host files for the existing domains.
|
||||
|
||||
I've chosen PHP 54 as the default PHP-FPM version on my server.
|
||||
|
||||
![confirm-php-fpm](http://blog.linoxide.com/wp-content/uploads/2016/01/confirm-php-fpm-1024x525.png)
|
||||
|
||||
Even though, the server is configured with PHP-FPM 54, we can modify the PHP-FPM instances for the individual domains via cPanel.
|
||||
|
||||
I'll explain you on how to modify the PHP-FPM instances for individual domains via cPanel using some screenshots.
|
||||
|
||||
The installation of Nginx plugin will provide you with an icon of Nginx Webstack in your domain's cPanel. You can click on that icon to configure your Web server. I've logged into one of my domain's cPanel to configure it's Web server.
|
||||
|
||||
Please check these snapshots.
|
||||
|
||||
![nginx webstack](http://blog.linoxide.com/wp-content/uploads/2016/01/nginx-webstack.png)
|
||||
|
||||
![nginxicon1](http://blog.linoxide.com/wp-content/uploads/2016/01/nginxicon1-1024x253.png)
|
||||
|
||||
Now you can configure the web-server for the selected main domain as required(I've selected the main domain saheetha.com here). I've gone ahead with automatic configuration options since, I don't have any manual settings to add.
|
||||
|
||||
![nginx_auto_proxy](http://blog.linoxide.com/wp-content/uploads/2016/01/nginx_auto_proxy-1024x408.png)
|
||||
|
||||
Once Nginx is configured, you can select the PHP-FPM instance for your domain here.
|
||||
|
||||
![php-fpm1](http://blog.linoxide.com/wp-content/uploads/2016/01/php-fpm1-1024x408.png)
|
||||
|
||||
![php54](http://blog.linoxide.com/wp-content/uploads/2016/01/php54-1024x169.png)
|
||||
|
||||
![php55](http://blog.linoxide.com/wp-content/uploads/2016/01/php55.png)
|
||||
|
||||
As you can see in these snapshots, my default PHP-FPM on the server is **PHP 54** and I'm changing the PHP-FPM instance for my domain alone to **PHP 55**. Once you've modified the PHP-FPM for your domain, you can confirm it by accessing the **phpinfo** page.
|
||||
|
||||
Thank you for referring to this article. I believe this article is really informative and useful for you. I would recommend your valuable comments on this :).
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://linoxide.com/linux-how-to/enable-multiple-php-fpm-instances-nginx-apache/
|
||||
|
||||
作者:[Saheetha Shameer][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://linoxide.com/author/saheethas/
|
@ -0,0 +1,201 @@
|
||||
How to Set Nginx as Reverse Proxy on Centos7 CPanel
|
||||
================================================================================
|
||||
|
||||
Nginx is one of the fastest and most powerful web-server. It is known for its high performance and low resource utilization. It can be installed as both a standalone and a Reverse Proxy Web-server. In this article, I'm discussing about the installation of Nginx as a reverse proxy along with Apache on a CPanel server with latest CentOS 7 installed.
|
||||
|
||||
Nginx as a reverse proxy will work as a frontend webserver serving static contents along with Apache serving the dynamic files in backend. This setup will boost up the overall server performance.
|
||||
|
||||
Let's walk through the installation steps for Nginx as reverse proxy in CentOS7 x86_64 bit server with cPanel 11.52 installed.
|
||||
|
||||
First of all, we need to install the EPEL repo to start-up with the process.
|
||||
|
||||
### Step 1: Install the EPEL repo. ###
|
||||
|
||||
root@server1 [/usr]# yum -y install epel-release
|
||||
Loaded plugins: fastestmirror, tsflags, universal-hooks
|
||||
Loading mirror speeds from cached hostfile
|
||||
* EA4: 66.23.237.210
|
||||
* base: mirrors.linode.com
|
||||
* extras: mirrors.linode.com
|
||||
* updates: mirrors.linode.com
|
||||
Resolving Dependencies
|
||||
--> Running transaction check
|
||||
---> Package epel-release.noarch 0:7-5 will be installed
|
||||
--> Finished Dependency Resolution
|
||||
|
||||
Dependencies Resolved
|
||||
|
||||
===============================================================================================================================================
|
||||
Package Arch Version Repository Size
|
||||
===============================================================================================================================================
|
||||
Installing:
|
||||
epel-release noarch 7-5 extras 14 k
|
||||
|
||||
### Step 2: After installing the repo, we can start with the installation of the nDeploy RPM repo for CentOS to install our required nDeploy Webstack and Nginx plugin. ###
|
||||
|
||||
root@server1 [/usr]# yum -y install http://rpm.piserve.com/nDeploy-release-centos-1.0-1.noarch.rpm
|
||||
Loaded plugins: fastestmirror, tsflags, universal-hooks
|
||||
nDeploy-release-centos-1.0-1.noarch.rpm | 1.7 kB 00:00:00
|
||||
Examining /var/tmp/yum-root-ei5tWJ/nDeploy-release-centos-1.0-1.noarch.rpm: nDeploy-release-centos-1.0-1.noarch
|
||||
Marking /var/tmp/yum-root-ei5tWJ/nDeploy-release-centos-1.0-1.noarch.rpm to be installed
|
||||
Resolving Dependencies
|
||||
--> Running transaction check
|
||||
---> Package nDeploy-release-centos.noarch 0:1.0-1 will be installed
|
||||
--> Finished Dependency Resolution
|
||||
|
||||
Dependencies Resolved
|
||||
|
||||
===============================================================================================================================================
|
||||
Package Arch Version Repository Size
|
||||
===============================================================================================================================================
|
||||
Installing:
|
||||
nDeploy-release-centos noarch 1.0-1 /nDeploy-release-centos-1.0-1.noarch 110
|
||||
|
||||
### Step 3: Install the nDeploy and Nginx nDeploy plugins. ###
|
||||
|
||||
root@server1 [/usr]# yum --enablerepo=ndeploy install nginx-nDeploy nDeploy
|
||||
Loaded plugins: fastestmirror, tsflags, universal-hooks
|
||||
epel/x86_64/metalink | 9.9 kB 00:00:00
|
||||
epel | 4.3 kB 00:00:00
|
||||
ndeploy | 2.9 kB 00:00:00
|
||||
(1/4): ndeploy/7/x86_64/primary_db | 14 kB 00:00:00
|
||||
(2/4): epel/x86_64/group_gz | 169 kB 00:00:00
|
||||
(3/4): epel/x86_64/primary_db | 3.7 MB 00:00:02
|
||||
|
||||
Dependencies Resolved
|
||||
|
||||
===============================================================================================================================================
|
||||
Package Arch Version Repository Size
|
||||
===============================================================================================================================================
|
||||
Installing:
|
||||
nDeploy noarch 2.0-11.el7 ndeploy 80 k
|
||||
nginx-nDeploy x86_64 1.8.0-34.el7 ndeploy 36 M
|
||||
Installing for dependencies:
|
||||
PyYAML x86_64 3.10-11.el7 base 153 k
|
||||
libevent x86_64 2.0.21-4.el7 base 214 k
|
||||
memcached x86_64 1.4.15-9.el7 base 84 k
|
||||
python-inotify noarch 0.9.4-4.el7 base 49 k
|
||||
python-lxml x86_64 3.2.1-4.el7 base 758 k
|
||||
|
||||
Transaction Summary
|
||||
===============================================================================================================================================
|
||||
Install 2 Packages (+5 Dependent packages)
|
||||
|
||||
With these steps, we've completed with the installation of Nginx plugin in our server. Now we need to configure Nginx as reverse proxy and create the virtualhost for the existing cPanel user accounts. For that we can run the following script.
|
||||
|
||||
### Step 4: To enable Nginx as a front end Web Server and create the default configuration files. ###
|
||||
|
||||
root@server1 [/usr]# /opt/nDeploy/scripts/cpanel-nDeploy-setup.sh enable
|
||||
Modifying apache http and https port in cpanel
|
||||
|
||||
httpd restarted successfully.
|
||||
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
|
||||
Created symlink from /etc/systemd/system/multi-user.target.wants/ndeploy_watcher.service to /usr/lib/systemd/system/ndeploy_watcher.service.
|
||||
Created symlink from /etc/systemd/system/multi-user.target.wants/ndeploy_backends.service to /usr/lib/systemd/system/ndeploy_backends.service.
|
||||
ConfGen:: saheetha
|
||||
ConfGen:: satest
|
||||
|
||||
As you can see these script will modify the Apache port from 80 to another port to make Nginx run as a front end web server and create the virtual host configuration files for the existing cPanel accounts. Once it is done, confirm the status of both Apache and Nginx.
|
||||
|
||||
### Apache Status: ###
|
||||
|
||||
root@server1 [/var/run/httpd]# systemctl status httpd
|
||||
● httpd.service - Apache Web Server
|
||||
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
|
||||
Active: active (running) since Mon 2016-01-18 06:34:23 UTC; 12s ago
|
||||
Process: 25606 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
|
||||
Main PID: 24760 (httpd)
|
||||
CGroup: /system.slice/httpd.service
|
||||
‣ 24760 /usr/local/apache/bin/httpd -k start
|
||||
|
||||
Jan 18 06:34:23 server1.centos7-test.com systemd[1]: Starting Apache Web Server...
|
||||
Jan 18 06:34:23 server1.centos7-test.com apachectl[25606]: httpd (pid 24760) already running
|
||||
Jan 18 06:34:23 server1.centos7-test.com systemd[1]: Started Apache Web Server.
|
||||
|
||||
### Nginx Status: ###
|
||||
|
||||
root@server1 [~]# systemctl status nginx
|
||||
● nginx.service - nginx-nDeploy - high performance web server
|
||||
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
|
||||
Active: active (running) since Sun 2016-01-17 17:18:29 UTC; 13h ago
|
||||
Docs: http://nginx.org/en/docs/
|
||||
Main PID: 3833 (nginx)
|
||||
CGroup: /system.slice/nginx.service
|
||||
├─ 3833 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
|
||||
├─25473 nginx: worker process
|
||||
├─25474 nginx: worker process
|
||||
└─25475 nginx: cache manager process
|
||||
|
||||
Jan 17 17:18:29 server1.centos7-test.com systemd[1]: Starting nginx-nDeploy - high performance web server...
|
||||
Jan 17 17:18:29 server1.centos7-test.com nginx[3804]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
|
||||
Jan 17 17:18:29 server1.centos7-test.com nginx[3804]: nginx: configuration file /etc/nginx/nginx.conf test is successful
|
||||
Jan 17 17:18:29 server1.centos7-test.com systemd[1]: Started nginx-nDeploy - high performance web server.
|
||||
|
||||
Nginx act as a frontend webserver running on port 80 and Apache configuration is modified to listen on http port 9999 and https port 4430. Please see their status below:
|
||||
|
||||
root@server1 [/usr/local/src]# netstat -plan | grep httpd
|
||||
tcp 0 0 0.0.0.0:4430 0.0.0.0:* LISTEN 17270/httpd
|
||||
tcp 0 0 0.0.0.0:9999 0.0.0.0:* LISTEN 17270/httpd
|
||||
tcp6 0 0 :::4430 :::* LISTEN 17270/httpd
|
||||
tcp6 0 0 :::9999 :::* LISTEN 17270/httpd
|
||||
|
||||
![apacheport](http://blog.linoxide.com/wp-content/uploads/2016/01/apacheport.png)
|
||||
|
||||
root@server1 [/usr/local/src]# netstat -plan | grep nginx
|
||||
tcp 0 0 127.0.0.1:80 0.0.0.0:* LISTEN 17802/nginx: master
|
||||
tcp 0 0 45.79.183.73:80 0.0.0.0:* LISTEN 17802/nginx: master
|
||||
|
||||
The virtualhost entries created for the existing users as located in the folder "**/etc/nginx/sites-enabled**". This file path is included in the Nginx main configuration file.
|
||||
|
||||
root@server1 [/etc/nginx/sites-enabled]# ll | grep .conf
|
||||
-rw-r--r-- 1 root root 311 Jan 17 09:02 saheetha.com.conf
|
||||
-rw-r--r-- 1 root root 336 Jan 17 09:02 saheethastest.com.conf
|
||||
|
||||
### Sample Vhost for a domain: ###
|
||||
|
||||
server {
|
||||
|
||||
listen 45.79.183.73:80;
|
||||
#CPIPVSIX:80;
|
||||
|
||||
# ServerNames
|
||||
server_name saheetha.com www.saheetha.com;
|
||||
access_log /usr/local/apache/domlogs/saheetha.com main;
|
||||
access_log /usr/local/apache/domlogs/saheetha.com-bytes_log bytes_log;
|
||||
|
||||
include /etc/nginx/sites-enabled/saheetha.com.include;
|
||||
|
||||
}
|
||||
|
||||
We can confirm the working of the web server status by calling a website in the browser. Please see the web server information on my server after the installation.
|
||||
|
||||
root@server1 [/home]# ip a | grep -i eth0
|
||||
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
|
||||
inet 45.79.183.73/24 brd 45.79.183.255 scope global dynamic eth0
|
||||
root@server1 [/home]# nginx -v
|
||||
nginx version: nginx/1.8.0
|
||||
|
||||
![webserver-status](http://blog.linoxide.com/wp-content/uploads/2016/01/webserver.png)
|
||||
|
||||
Nginx will create the virtual host automatically for any newly created accounts in cPanel. With these simple steps we can configure Nginx as reverse proxy on a CentOS 7/CPanel server.
|
||||
|
||||
### Advantages of Nginx as Reverse Proxy: ###
|
||||
|
||||
1. Easy to install and configure
|
||||
2. Performance and efficiency
|
||||
3. Prevent DDOS attacks
|
||||
4. Allows .htaccess PHP rewrite rules
|
||||
|
||||
I hope this article is useful for you guys. Thank you for referring to this. I would appreciate your valuable comments and suggestions on this for further improvements.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://linoxide.com/linux-how-to/set-nginx-reverse-proxy-centos-7-cpanel/
|
||||
|
||||
作者:[Saheetha Shameer][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://linoxide.com/author/saheethas/
|
@ -1,14 +1,15 @@
|
||||
Linux / Unix Desktop Fun: Text Mode ASCII-art Box and Comment Drawing
|
||||
Linux/Unix桌面趣事:文本模式艺术框及注释图
|
||||
================================================================================
|
||||
Boxes command is a text filter and a little known tool that can draw any kind of ASCII art box around its input text or code for fun and profit. You can quickly create email signatures, or create regional comments in any programming language. This command was intended to be used with the vim text editor, but can be tied to any text editor which supports filters, as well as from the command line as a standalone tool.
|
||||
boxes是一个文本过滤器并且是一个鲜为人知的可以在文字或者代码周围绘出任何形式的ASCII艺术框的工具。你可以快速地创建一个email签名或者在任何语言中创建一个注释。这个命令可以和vim一起使用,但是可以和任何支持过滤和可以在命令行中使用独立工具的文本编辑器绑定在一起。。
|
||||
|
||||
### Task: Install boxes ###
|
||||
### 任务: 安装 boxes ###
|
||||
|
||||
Use the [apt-get command][1] to install boxes under Debian / Ubuntu Linux:
|
||||
在Debian/Ubuntu中使用[apt-get命令][1]来安装boxes:
|
||||
|
||||
$ sudo apt-get install boxes
|
||||
|
||||
Sample outputs:
|
||||
示例输出:
|
||||
|
||||
Reading package lists... Done
|
||||
Building dependency tree
|
||||
@ -24,11 +25,11 @@ Sample outputs:
|
||||
Processing triggers for man-db ...
|
||||
Setting up boxes (1.0.1a-2.3) ...
|
||||
|
||||
RHEL / CentOS / Fedora Linux users, use the [yum command to install boxes][2] (first [enable EPEL repo as described here][3]):
|
||||
对于RHEL / CentOS / Fedora用户,使用[yum命令来安装boxes][2](首先[启用EPEL仓库][3])
|
||||
|
||||
# yum install boxes
|
||||
|
||||
Sample outputs:
|
||||
示例输出:
|
||||
|
||||
Loaded plugins: rhnplugin
|
||||
Setting up Install Process
|
||||
@ -61,50 +62,51 @@ Sample outputs:
|
||||
Complete!
|
||||
|
||||
FreeBSD user can use the port as follows:
|
||||
FreeBSD用户可以使用port:
|
||||
|
||||
cd /usr/ports/misc/boxes/ && make install clean
|
||||
|
||||
Or, add the package using the pkg_add command:
|
||||
或者使用pkg_add命令添加包:
|
||||
|
||||
# pkg_add -r boxes
|
||||
|
||||
### Draw any kind of box around some given text ###
|
||||
### 用给定的文字画出任何形式的框 ###
|
||||
|
||||
Type the following command:
|
||||
输入下面的额命令:
|
||||
|
||||
echo "This is a test" | boxes
|
||||
|
||||
Or specify the name of the design to use:
|
||||
或者指定设计:
|
||||
|
||||
echo -e "\n\tVivek Gite\n\tvivek@nixcraft.com\n\twww.cyberciti.biz" | boxes -d dog
|
||||
|
||||
Sample outputs:
|
||||
示例输出:
|
||||
|
||||
![Unix / Linux: Boxes Command To Draw Various Designs](http://s0.cyberciti.org/uploads/l/tips/2012/06/unix-linux-boxes-draw-dog-design.png)
|
||||
|
||||
Fig.01: Unix / Linux: Boxes Command To Draw Various Designs
|
||||
图01:Unix / Linux:Box命令来画出不同的设计
|
||||
|
||||
#### How do I list all designs? ####
|
||||
#### 我如何列出所有的设计? ####
|
||||
|
||||
The syntax is:
|
||||
语法是:
|
||||
|
||||
boxes option
|
||||
pipe | boxes options
|
||||
echo "text" | boxes -d foo
|
||||
boxes -l
|
||||
|
||||
The -d design option sets the name of the design to use. The syntax is:
|
||||
-d选项设置使用的设计。语法是:
|
||||
|
||||
echo "Text" | boxes -d design
|
||||
pipe | boxes -d desig
|
||||
|
||||
The -l option list designs. It produces a listing of all available box designs in the config file, along with a sample box and information about it's creator:
|
||||
-l选项列出设计列表。它会列出配置文件中所有的设计,以及它的设计者的一些信息:
|
||||
|
||||
boxes -l
|
||||
boxes -l | more
|
||||
boxes -l | less
|
||||
|
||||
Sample outputs:
|
||||
示例输出:
|
||||
|
||||
43 Available Styles in "/etc/boxes/boxes-config":
|
||||
-------------------------------------------------
|
||||
@ -140,32 +142,32 @@ Sample outputs:
|
||||
output truncated
|
||||
..
|
||||
|
||||
### How do I filter text via boxes while using vi/vim text editor? ###
|
||||
### 我如何在vi/vim中使用boxes过滤文本? ###
|
||||
|
||||
You can use any external command with vi or vim. In this example, [insert current date and time][4], enter:
|
||||
你可以在vi或者vim中使用任何外部命令。比如,[插入日期和时间][4],输入:
|
||||
|
||||
!!date
|
||||
|
||||
OR
|
||||
或者
|
||||
|
||||
:r !date
|
||||
|
||||
You need to type above command in Vim to read the output from the date command. This will insert the date and time after the current line:
|
||||
你需要在vim中输入上面的命令来读取date命令的输出。这可以在当前行中插入时间和日期:
|
||||
|
||||
Tue Jun 12 00:05:38 IST 2012
|
||||
|
||||
You can do the same with boxes command. Create a sample shell script or a c program as follows:
|
||||
你可以用boxes命令做同样的事情。如下创建一个示例脚本或者程序:
|
||||
|
||||
#!/bin/bash
|
||||
Purpose: Backup mysql database to remote server.
|
||||
Author: Vivek Gite
|
||||
Last updated on: Tue Jun, 12 2012
|
||||
|
||||
Now type the following (move cursor to the second line i.e. line which starts with "Purpose: ...")
|
||||
现在输入下面的命令(移动光标到第二行,也就是说以Purpose开头的那行)
|
||||
|
||||
3!!boxes
|
||||
|
||||
And voila you will get the output as follows:
|
||||
你就会得到下面的示例输出:
|
||||
|
||||
#!/bin/bash
|
||||
/****************************************************/
|
||||
@ -175,22 +177,22 @@ And voila you will get the output as follows:
|
||||
/****************************************************/
|
||||
|
||||
This video will give you an introduction to boxes command:
|
||||
这个视频是boxes命令的一个介绍
|
||||
|
||||
注:youtube 视频
|
||||
<iframe width="595" height="446" frameborder="0" src="http://www.youtube.com/embed/glzXjNvrYOc?rel=0"></iframe>
|
||||
|
||||
(Video:01: boxes command in action. BTW, this is my first video so go easy on me and let me know what you think.)
|
||||
(视频01:boxes命令实践。顺便说一下,这是我的第一个视频,所以对我不要太认真并让我知道你们所想)
|
||||
同样可见
|
||||
|
||||
See also
|
||||
|
||||
- boxes man page
|
||||
- boxes man页
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.cyberciti.biz/tips/unix-linux-draw-any-kind-of-boxes-around-text-editor.html
|
||||
|
||||
作者:Vivek Gite
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
@ -199,3 +201,5 @@ via: http://www.cyberciti.biz/tips/unix-linux-draw-any-kind-of-boxes-around-text
|
||||
[2]:http://www.cyberciti.biz/faq/rhel-centos-fedora-linux-yum-command-howto/
|
||||
[3]:http://www.cyberciti.biz/faq/fedora-sl-centos-redhat6-enable-epel-repo/
|
||||
[4]:http://www.cyberciti.biz/faq/vim-inserting-current-date-time-under-linux-unix-osx/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user