centos 查看nginx?centos7登录界面

大家好,今天给各位分享centos 查看nginx的一些知识,其中也会对centos7登录界面进行解释,文章篇幅可能偏长,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在就马上开始吧!

4:Nginx服务启动、停止、重启

在上两节中,您已成功在服务器或个人电脑上安装了Nginx,并对基础配置有了初步了解。本节将重点介绍Nginx的基本操作,包括启动、停止、重启等。

启动

启动Nginx时,首先需连接至服务器。若操作系统为CentOS7.4及以上版本,请输入命令:

如Nginx已启动,提示端口被占用,需先结束占用端口的进程,再重启Nginx。若无任何提示,需检查Nginx运行状态。

启动成功后,将显示类似的结果。

停止

Nginx停止方法多样,可依据需求选择。主要有:

立即停止:不考虑进程状态,直接停止。

从容停止:等待当前任务完成后再停止。

killall方法:直接结束进程,但若直接使用效果不佳,此方法较为适用。

systemctl停止:在更改配置文件后,需使用此命令重新加载配置。

若需查看端口使用情况,请执行命令。

总结:启动、停止、重启、重载Nginx,以及检查端口占用和运行状态,是基本操作。正确执行这些步骤,可确保Nginx的稳定运行。

centos 使用yum安装nginx后如何添加模块

1.确认你已经安装在用的nginx信息

nginx-V

2.下载和此版本相同的nginx源码包并解压

wget

tar-xvzfnginx-1.10.3.tar.gz

3.更新一下依赖相关包

yum-yinstallpcre*

4.这里以增加 nginx-rtmp-moudle为例,下载你要增加的模块

wget

mvv1.1.10.tar.gznginx-rtmp-1.1.10.tar.gz

tar-zxvfnginx-rtmp-1.1.10.tar.gz

5.下面开始进入正题

#停掉nginx服务

servicenginxstop

#进入解压的nginx-1.10.3目录

cdnginx-1.10.3

#编译./configure后面加上第1步nginx-V查看到的所有配置参数,后面加上你要加的模块配置

./configure--prefix=/etc/nginx--sbin-path=/usr/sbin/nginx...(太长我省略了)--add-module=/root/nginx-rtmp-module-1.1.10

make

千万别makeinstall

验证新nginx是否可用验证编译后的nginx是否可以使用已有的配置

./objs/nginx-t

使用新nginx

备份cp/usr/sbin/nginx/usr/sbin/nginx-bak

替换cp./objs/nginx/usr/sbin/nginx

ok了,重启nginx

servicenginxstart

祝你成功!

centos系统编译安装nginx+php环境另加独立mysql教程

前端(nginx+php)ip:192.168.10.8

后端(独立mysql)ip:192.168.10.5

软件版本:libiconv-1.14.tar.gz mysql-5.1.63.tar.gz php-5.2.17.tar.gz php-5.2.17-fpm-0.5.14.diff.gz php-5.2.17-max-input-vars.patch

1.先在后端安装mysql

在192.168.10.5上只安装mysql.方法可以去看centos编译安装nginx+php-fpm+mysql里的mysql安装.

2.在前端安装php-fpm nginx和mysql-client

这里只说下安装mysql-client和php的编译安装.

                代码如下   tar zxf mysql-5.1.63.tar.gz cd mysql-5.1.63

./configure--prefix=/usr/local/mysql--without-server           

这里只需要加上--without-server就可以让mysql变成客户端了.

如果出现/bin/rm: cannot remove `libtoolt': No such file or directory,可以去看这篇文章Mysql安装:/bin/rm: cannot remove `libtoolt': No such file or directory.

没有问题后,执行命令:

                代码如下   make make install           

编译php的时候只需要加上--with-mysql=mysql客户端安装目录就可以了.这里我给出编译参数:

                代码如下   ./configure--prefix=/usr/local/php--enable-fastcgi--enable-fpm--with-fpm-log=/var/log/php-fpm.log\

--with-fpm-conf=/etc/php-fpm.conf--with-fpm-pid=/var/run/php-fpm.pid--with-config-file-path=/etc\

--with-config-file-scan-dir=/etc/php.d--with-openssl--with-zlib--enable-bcmath--with-bz2--with-curl\

--enable-ftp--with-gd--enable-gd-native-ttf--with-jpeg-dir--with-png-dir--with-gettext--with-mhash\

--enable-mbstring--with-mcrypt--enable-soap--enable-zip--with-iconv=/usr/local/libiconv\

--with-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config--without-pear           

nginx的编译没有什么好说的了,我前面centos编译安装nginx+php-fpm+mysql这篇文章里已经有讲过了.

3.进行测试验证

当上面的一切都安装好之后,在后端的mysql里给出远程权限,如下:

                代码如下   GRANT ALL PRIVILEGES ON*.* TO'root'@'%' IDENTIFIED BY'123456';           

然后iptables上只允许192.168.10.8访问mysql端口,其他都拒绝.如:

                代码如下   iptables-A RH-Firewall-1-INPUT-s 192.168.10.8-p tcp-m tcp--dport 3306-j ACCEPT

iptables-A RH-Firewall-1-INPUT-p tcp--dport 3306-j DROP

services iptables save

services iptables restart           

然后在192.168.10.8上进行测试,是否可以远程连上mysql

mysql-h 192.168.10.5-u root-p

如果可以连上,就继续下一步的操作,不能连上的话请检查上面是否有错误的地方.

现在我们加个php页面来测试php是否可以连上mysql,脚本如下:

                代码如下   ?php

$link=mysql_connect("192.168.10.5","root","123456");

if(!$link) echo"bad!";

else echo"ok!";

mysql_close();

?           

成功的话是ok!的输出,失败的话是bad!的输出,我这里是成功的

mysql 5.5.x的只安装客户端.

需要的软件:libiconv-1.14.tar.gz mysql-5.5.25a.tar.gz

1.安装前的准备

安装前的准备,可以去看这篇文章centos编译安装nginx+php-fpm+mysql

2.安装libiconv

                代码如下   ./configure--prefix=/usr/local/libiconv

make make install           

3.只安装mysql客户端

                代码如下   cmake. make mysqlclient libmysql

make install           

这样就只安装了mysql客户端,然后可以输入whereis mysql来查看mysql安装位置.

whereis mysql

好了,可以看到跟yum安装的差不多.

4.安装php

以前mysql是5.1的时候,只需要加上--with-mysql=mysql客户端安装目录就可以了,但在mysql 5.5.x这个参数就要改变下了,下面是php的编译参数:

                代码如下   ./configure--prefix=/usr/local/php--enable-fastcgi--enable-fpm--with-fpm-log=/var/log/php-fpm.log--with-fpm-conf=/etc/php-fpm.conf\

--with-fpm-pid=/var/run/php-fpm.pid--with-config-file-path=/etc--with-config-file-scan-dir=/etc/php.d\

--with-openssl--with-zlib--enable-bcmath--with-bz2--with-curl--enable-ftp\

--with-gd--enable-gd-native-ttf--with-jpeg-dir--with-png-dir--with-gettext--with-mhash\

--enable-mbstring--with-mcrypt--enable-soap--enable-zip--with-iconv=/usr/local/libiconv\

--with-mysql=shared,/usr--with-mysqli=shared,/usr/bin/mysql_config           

大家可以看最后一行,--with-mysql=shared,/usr--with-mysqli=shared,/usr/bin/mysql_config这就是跟以前不同的行.好了,剩下的就不写了

阅读剩余
THE END