Directorio de artículos
1. Introducción
L: sistema Linux
A: servidor apache (en su lugar también se puede usar nginx)
M: se refiere a la base de datos mysql o mariadb
P: se refiere a lenguajes de programación como PHP, python y perl.
La arquitectura general de la lámpara puede referirse a: Linux / unix / windows + apache / nginx ... + mysql / pgsql + php / python / perl / golang
2. Cree un servidor web nginx
El sistema Linux utilizado en este artículo es Red Hat 7.6 Enterprise Edition
1. Descargar paquetes de recursos relacionados
[root@server1 ~]# ls
nginx-1.18.0.tar.gz
[root@server1 ~]# tar zxf nginx-1.18.0.tar.gz %解压
[root@server1 ~]# ls
nginx-1.18.0 nginx-1.18.0.tar.gz
[root@server1 ~]# cd nginx-1.18.0/
[root@server1 nginx-1.18.0]# ls %源码安装时解压目录中的初始文件
auto CHANGES.ru configure html man src
CHANGES conf contrib LICENSE README
安装相关工具:
[root@server1 nginx-1.18.0]# yum install gcc -y %编译需要的包
[root@server1 nginx-1.18.0]# yum install pcre-devel -y %http重写功能需要的包
[root@server1 nginx-1.18.0]# yum install -y openssl-devel %ssl功能需要的包
2. Compile e instale
[root@server1 nginx-1.18.0]# vim auto/cc/gcc %注释掉debug选项,可以使安装最小化
[root@server1 nginx-1.18.0]# ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module %编译,编译参数可自由选择
[root@server1 nginx-1.18.0]# make && make install %安装
3. Agregue variables de entorno e inicie el servicio
[root@server1 sbin]# pwd
/usr/local/nginx/sbin
[root@server1 sbin]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@server1 ~]# vim .bash_profile %注意路径(/root/下)
[root@server1 ~]# source .bash_profile %使上述更改生效
[root@server1 ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin:/usr/local/nginx/sbin
[root@server1 ~]# which nginx
/usr/local/nginx/sbin/nginx
[root@server1 ~]# nginx %运行nginx服务,nginx stop为关闭nginx服务
4. Prueba
安装tools工具,查看是否开启80端口
[root@server1 ~]# yum install -y net-tools
[root@server1 ~]# netstat -antulp
编写测试页面并访问进行测试
[root@server1 ~]# curl localhost %使用curl命令进行测试,观察是否能够访问通畅
[root@server1 ~]# cd /usr/local/nginx/
[root@server1 nginx]# ls
client_body_temp fastcgi_temp logs sbin uwsgi_temp
conf html proxy_temp scgi_temp
[root@server1 nginx]# cd html/
[root@server1 html]# ls
50x.html index.html
[root@server1 html]# vim test.html
[root@server1 html]# curl localhost:/test.html %编辑测试页,进行访问,观察是否能够访问到
www.westos.org