什么是大型门户网站,wordpress 下划线,中国十大网络公司排名,在线设计平台设计师招募目录
一、Nginx下载
二、安装步骤
1、在 /docker目录下新建 nginx 文件夹
2、将解压包移动到nginx目录下并解压到nginx目录
3、进入 nginx目录#xff0c;找到 configure
4、运行 configure#xff0c;命令
5、安装
6、查看根目录
7、进入Nginx目录下的conf文件夹…目录
一、Nginx下载
二、安装步骤
1、在 /docker目录下新建 nginx 文件夹
2、将解压包移动到nginx目录下并解压到nginx目录
3、进入 nginx目录找到 configure
4、运行 configure命令
5、安装
6、查看根目录
7、进入Nginx目录下的conf文件夹
三、运行Nginx
1、进入Nginx的根目录中的sbin目录
2、按默认配置启动
3、输入地址运行
四、演示修改 Nginx 配置修改端口号
1、找到 /conf 目录下的 nginx.conf 配置文件
2、直接使用finalshell打开nginx.conf
3、修改监听端口为666
4、重启nginx
五、使用 Nginx 转发访问后端服务
1、启动 spring boot 项目
2、在浏览器中测试访问接口
3、进行nginx配置
4、运行结果测试
5、结果测试 一、Nginx下载
从官网中下载 nginx 压缩包到本地http://nginx.org/en/download.html 二、安装步骤
1、在 /docker目录下新建 nginx 文件夹 mkdir /docker/nginx 2、将解压包移动到nginx目录下并解压到nginx目录 tar -zxvf nginx-1.24.0.tar.gz 3、进入 nginx目录找到 configure yum -y install gcc openssl openssl-devel pcre-devel zlib zlib-devel 4、运行 configure命令 ./configure 5、安装 make make install 6、查看根目录 whereis nginx 7、进入Nginx目录下的conf文件夹 cd /usr/local/nginx/conf 里面又nginx.conf配置文件可以进行配置
三、运行Nginx
1、进入Nginx的根目录中的sbin目录 cd /usr/local/nginx/sbin 2、按默认配置启动 ./nginx 3、输入地址运行 Welcome to nginx! 四、演示修改 Nginx 配置修改端口号
1、找到 /conf 目录下的 nginx.conf 配置文件 cd usr/local/nginx/nginx-1.24.1/conf/ 2、直接使用finalshell打开nginx.conf
3、修改监听端口为666
4、重启nginx ./nginx -s reload 五、使用 Nginx 转发访问后端服务
1、启动 spring boot 项目 2、在浏览器中测试访问接口
这是本地项目接口
192.168.31.196:8888/course/test/01 3、进行nginx配置 #user nobody;
worker_processes 1;#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;#pid logs/nginx.pid;events {worker_connections 1024;
}http {include 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 logs/access.log main;sendfile on;#tcp_nopush on;#keepalive_timeout 0;keepalive_timeout 65;#gzip on;server {listen 80;server_name localhost;#charset koi8-r;#access_log logs/host.access.log main;location / {root html;index index.html index.htm;}#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;}# proxy the PHP scripts to Apache listening on 127.0.0.1:80##location ~ \.php$ {# proxy_pass http://127.0.0.1;#}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000##location ~ \.php$ {# root html;# fastcgi_pass 127.0.0.1:9000;# fastcgi_index index.php;# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;# include fastcgi_params;#}# deny access to .htaccess files, if Apaches document root# concurs with nginxs one##location ~ /\.ht {# deny all;#}}# another virtual host using mix of IP-, name-, and port-based configuration##server {# listen 8000;# listen somename:8080;# server_name somename alias another.alias;# location / {# root html;# index index.html index.htm;# }#}# HTTPS server##server {# listen 443 ssl;# server_name localhost;# ssl_certificate cert.pem;# ssl_certificate_key cert.key;# ssl_session_cache shared:SSL:1m;# ssl_session_timeout 5m;# ssl_ciphers HIGH:!aNULL:!MD5;# ssl_prefer_server_ciphers on;# location / {# root html;# index index.html index.htm;# }#}server {listen 8888;server_name localhost;location /course/ { proxy_pass http://192.168.31.196:8888/course/; }}}最下方就是server的监听端口8888通过/course跳转到windows的ip地址/course并进行转发
4、运行结果测试
虚拟机ip地址 5、结果测试 成功从192.168.58.131跳转到192.168.31.196
并访问端口成功