首页 > 编程知识 正文

虚拟机linux怎么连接内网,ubuntu怎么访问外网

时间:2023-05-05 01:42:33 阅读:172137 作者:3727

使用SSH连接AlibabaCloud (阿里巴巴云)在Nginx上传输数据1. Nginx安装1.1安装1.2安装Nginx1.2.1下载1.2.2安装 1. Nginx安装1.1依赖安装 GCC的安装 sudo apt-get install gcc检查安装是否成功 gcc --version如下图所示表示正确安装 安装其他依赖关系 sudo apt-getinstallibpcre3lib pcre3- devsudoapt-getinstallzlib 1g zlib 1g-devsudoapt-getinstallopensslopenssl-dev 1.2 在这里从NGINX官网的下载页面下载nginx-1.20.1的版本,就会成为图像中Stable Version的中间(因为环境是Ubuntu 18.04 )。 1.2.2在安装SFTP中连接到ECS并上传文件 通过SSH连接到ECS,并将nginx解压到/usr/local目录 检查CD~tar-xvf nginx-1.20.1.tar.gz-c/usr/local解压缩是否完成 cd /usr/local/ls 上图中出现的深蓝色nginx-1.20.1是解压缩后的文件。 (PS :这里也出现了深蓝色的nginx。 这是我安装的文件夹的位置。 这个博客是我完全安装后写的。 ) ) ) ) ) ) )。 接下来,进入目录 cdnginx-XXX./configure-- prefix=/usr/local/nginx-- with-http _ stub _ status _ module-- with-OpenSSL OpenSSL-1.0.1 j-- with-http _ SSL _ module 如果不能m _ SSL _ modulemakemakeinstallmake,请使用以下命令 sudo apt-getupdatesudoapt-getinstallubuntu-make我自己在安装时还出现了以下错误。 (此错误出现在make summary之后。 ) openssl library is not used出现上述问题是因为安装nginx时没有指定OpenSSL的解压缩路径。 输入以下命令进行解决 ./configure-- prefix=/usr/local/nginx-- with-OpenSSL=/usr/local/OpenSSL-1.1.1k-- with-http _。 - with-pcre=/usr/local/pcre-7.7-- with-zlib=/usr/local/zlib-1.2.3-- with-http _ stub _ statate /典雅的水壶/sh : line 2:/config : nosuchfileordirectorymake [1] : * * [/usr/local/SSL/. opensl/inclurinclectrectincting nginx-1.20.1 ' make : * * [ build ] error 2我们先进入/usr/local/nginx-中 下一个代码 core _ incs=' $ core _ incs $ OpenSSL/. OpenSSL/include ' core _ deps=' $ core _ deps $ OpenSSL/. OpenSSL/incll . OpenSSL/lib/libcrypto.a ' core _ libs=' $ core _ libs=$ core _ libs core _ incs=' $ core _ incs $ OpenSSL/include ' core _ deps $ OpenSSL/include/OpenSSL.h libssl 生成安装最后释放端口 /s典雅水壶/iptables-I input-ptcp-- dport 80-j accept访问您的网站,查看以下内容,说明nginx运行正常 2. SSH连接和Nginx传输2.1公共网络服务设置使用 ps -ef | grep nginx检查安装位置。 此处显示./nginx 结合我们以前的安装地址,应该在/usr/local/中。 我们进入了以下目录/usr/local/nginx/s典雅的水壶 运行cd /usr/local/nginx/s优雅的水壶 ./nginx -t 显示OK和Successful表示Nginx正常运行。 然后转到/usr/local/nginx/conf目录并编辑名为nginx.conf的文件 添加vim nginx.conf lcddyx ustream tunnel { server 127.0.0.1:7689; }server {listen 80; server_name xxxxxxxx

x.xxx; location/{ proxy _ set _ headerx-real-IP $ remote _ addr; proxy _ set _ headerx-forwarded-for $ proxy _ add _ x _ forwarded _ for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://tunnel; }在这里创建了Nginx的转发。 当有人访问xxx时

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。