您的位置:首页 > 汽车 > 新车 > 自己设计网页作业的感悟_无经验培训 网页设计学员_模板网站建站公司_郑州见效果付费优化公司

自己设计网页作业的感悟_无经验培训 网页设计学员_模板网站建站公司_郑州见效果付费优化公司

2025/2/24 6:24:54 来源:https://blog.csdn.net/wxuejunzi/article/details/145707915  浏览:    关键词:自己设计网页作业的感悟_无经验培训 网页设计学员_模板网站建站公司_郑州见效果付费优化公司
自己设计网页作业的感悟_无经验培训 网页设计学员_模板网站建站公司_郑州见效果付费优化公司

nginx: download下载地址

cd /data
tar -zxvf nginx-1.27.3.tar.gz
cd nginx-1.27.3
useradd nginx

安装依赖

百度网盘地址如下

通过网盘分享的文件:yilai.zip
链接: https://pan.baidu.com/s/1HNOV-fpBTdskDBl0pR8jug?pwd=1234 提取码: 1234

#安装所有依赖

sudo dpkg -i ./*.deb

 cd /data/nginx-1.27.3

 下面代码直接执行

./configure  \
--prefix=/usr/local/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--http-client-body-temp-path=/do/nginx/tmp/client \
--http-proxy-temp-path=/do/nginx/tmp/nginx/proxy \
--http-fastcgi-temp-path=/do/nginx/tmp/nginx/fcgi \
--http-uwsgi-temp-path=/do/nginx/tmp/nginx/uwsgi \
--http-scgi-temp-path=/do/nginx/tmp/nginx/scgi \
--user=nginx \
--group=nginx \
--with-http_v2_module \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-mail \
--with-mail_ssl_module \
--with-file-aio \
--with-ipv6 \
--with-threads \
--with-stream \
--with-stream_ssl_module

 

sudo mkdir -p /do/nginx/tmp/client
sudo mkdir -p /do/nginx/tmp/nginx/proxy 
sudo mkdir -p /do/nginx/tmp/nginx/fcgi 
sudo mkdir -p /do/nginx/tmp/nginx/uwsgi 
sudo mkdir -p /do/nginx/tmp/nginx/scgi #编译
make && make install
#查看版本
nginx -v

nginx 服务配置文件

 

sudo vi /etc/systemd/system/nginx.service#内容如下
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network.target remote-fs.target nss-lookup.target[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
ExecReload=/usr/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true[Install]
WantedBy=multi-user.target 

 

配置/etc/nginx/nginx.conf文件

 该配置文件是一个直接监听到端口的配置文件,如果只要监听一个端口直接更改server就行,如果需要监听好几个,可以将其替换成另一个配置文件,再将配置文件统一放入一个目录

如下将/etc/nginx/nginx.conf文件整体替换成以下内容,

    include /etc/nginx/conf.d/*.conf;代表监听这个里面的所有配置文件

/etc/nginx/conf.d/这个目录需要自己创建

user  root;
worker_processes  auto;error_log  /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;events {worker_connections  1024;
}http {include       /etc/nginx/mime.types;default_type  application/octet-stream;log_format  main  '$remote_addr - $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"';access_log  /var/log/nginx/access.log  main;sendfile        on;keepalive_timeout  65;include /etc/nginx/conf.d/*.conf;
}

 在放一个8001.conf文件在/etc/nginx/conf.d/这个目录里

server {listen       8001;server_name  localhost;#charset koi8-r;#access_log  logs/host.access.log  main;#前端文件location / {proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;root /data/web/;try_files $uri $uri/ /index.html last;index index.html;}#后端location /admin-api {proxy_pass http://192.168.1.198:48080/admin-api;proxy_redirect off;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_intercept_errors on;error_page 301 302 307 = @handle_redirects;}location @handle_redirects {set $saved_redirect_location '$upstream_http_location';proxy_pass $saved_redirect_location;}location /static {add_header Access-Control-Allow-Origin *;add_header Access-Control-Allow-Methods 'GET,POST';add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';alias /mount/static;try_files $uri $uri/ /index.html last;proxy_store_access user:rw group:rw all:rw;index index.html;expires      7d;}#error_page  404              /404.html;# redirect server error pages to the static page /50x.html#error_page   500 502 503 504  /50x.html;location = /50x.html {root   html;}
}

 

重启

sudo systemctl restart nginx

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com