时间:2023-03-16 19:04:01 | 来源:电子商务
时间:2023-03-16 19:04:01 来源:电子商务
分享一篇文章,来自马哥教育学员阿龙。yum -y install nginx mariadb-server php-fpm php-mysqlsystemctl start nginxsystemctl start mariadbsystemctl start php-fpm
2、修改nginx的配置文件① user nobody; 使用用户error_log /var/log/nginx/error.log info; 错误日志② events { worker_connections 65535; }③ tcp_nopush on; tcp优化tcp_nodelay on; gzip on;④ server { listen 80; server_name xiaomi.along.com; 根据自己顺便写 root /data/web; 主站点的目录根location / { index index.php index.html index.htm; }⑤ location ~ /.php$ { 开启.php,配置文件有例子,只需去掉注释,修改一行即可 fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
(2)修改完,可以nginx -t 查看ulimit -n 65535 修改内核参数
3、修改php-fpm的配置文件date.timezone = Asia/Shanghai 时区short_open_tag = On 允许短标签
② vim /etc/php-fpm.d/www.conf 改两行user = nobodygroup = nobody
③ systemctl restart php-fpmcreate database xiaomi;
5、把事先找好的小米网站传进来 rzmkdir /data/web -p 创建一个目录专门放小米的网页配置unzip -d /data/web/ xiaomi.zip 解压到目录cd /data/web/chown -R nobody.nobody * 为了安全,递归把所有文件的所属人和所属组改为权限有限的nobody
6、网页登录vim /data/web/data/config.php
③ 把数据写到数据库中,恢复数据ab -c 100 -n 1000 http://192.168.30.107/
mkdir /etc/nginx/ssl
2、自签名证书cd /etc/pki/tls/certs/make nginx.crt
openssl rsa -in nginx.key -out nginx2.key 因为刚私钥被加密了,为了后边方便,解密
3、把证书和私钥cp 到nginx存放证书目录cp nginx.crt nginx2.key /etc/nginx/ssl/cd /etc/nginx/ssl/mv nginx2.key nginx.key 把名字改回来
4、修改配置文件,加一段serverserver { listen 443 ssl; server_name www.along.com; ssl on; ssl_certificate /etc/nginx/ssl/nginx.crt; ssl_certificate_key /etc/nginx/ssl/nginx.key; ssl_session_cache shared:sslcache:20m; ssl_session_timeout 10m;}
5、测试,网页打开 https://192.168.30.7/make nginx.crtmake nginx2.crtmake nginx3.crt
2、把证书和私钥cp 到nginx存放证书目录,并解开私钥的加密cp nginx{1,2,3}* /etc/nginx/ssl/openssl rsa -in nginx.key -out nginx.keyopenssl rsa -in nginx2.key -out nginx2.keyopenssl rsa -in nginx3.key -out nginx3.key
3、创建各自对应的访问网页mkdir /app/website{1,2,3}echo website1 > /app/website1/index.htmlecho website1 > /app/website2/index.htmlecho website1 > /app/website3/index.html
4、测试访问,成功cd /etc/nginx/conf.dhtpasswd -c -m .htpasswd http1htpasswd -m .htpasswd http2
2、在配置文件中修改location /images { auth_basic "images site"; "提示字" auth_basic_user_file /etc/nginx/conf.d/.htpasswd;}
3、网页查看验证 http://172.17.22.22/images/loading.gif关键词:实战,手记,小米