時(shí)間:2023-03-16 19:04:01 | 來源:電子商務(wù)
時(shí)間:2023-03-16 19:04:01 來源:電子商務(wù)
分享一篇文章,來自馬哥教育學(xué)員阿龍。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; 錯(cuò)誤日志② events { worker_connections 65535; }③ tcp_nopush on; tcp優(yōu)化tcp_nodelay on; gzip on;④ server { listen 80; server_name xiaomi.along.com; 根據(jù)自己順便寫 root /data/web; 主站點(diǎn)的目錄根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 修改內(nèi)核參數(shù)
3、修改php-fpm的配置文件date.timezone = Asia/Shanghai 時(shí)區(qū)short_open_tag = On 允許短標(biāo)簽
② vim /etc/php-fpm.d/www.conf 改兩行user = nobodygroup = nobody
③ systemctl restart php-fpmcreate database xiaomi;
5、把事先找好的小米網(wǎng)站傳進(jìn)來 rzmkdir /data/web -p 創(chuàng)建一個(gè)目錄專門放小米的網(wǎng)頁配置unzip -d /data/web/ xiaomi.zip 解壓到目錄cd /data/web/chown -R nobody.nobody * 為了安全,遞歸把所有文件的所屬人和所屬組改為權(quán)限有限的nobody
6、網(wǎng)頁登錄vim /data/web/data/config.php
③ 把數(shù)據(jù)寫到數(shù)據(jù)庫中,恢復(fù)數(shù)據(jù)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 因?yàn)閯偹借€被加密了,為了后邊方便,解密
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、測(cè)試,網(wǎng)頁打開 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、創(chuàng)建各自對(duì)應(yīng)的訪問網(wǎng)頁mkdir /app/website{1,2,3}echo website1 > /app/website1/index.htmlecho website1 > /app/website2/index.htmlecho website1 > /app/website3/index.html
4、測(cè)試訪問,成功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、網(wǎng)頁查看驗(yàn)證 http://172.17.22.22/images/loading.gif關(guān)鍵詞:實(shí)戰(zhàn),手記,小米
客戶&案例
營銷資訊
關(guān)于我們
微信公眾號(hào)
版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。