打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
基于nginx,如何搭建web的yum源?

前期的准备工作:两台Centos 6的主机,nginx安装包,cetos 6的iso包

两台主机的ip配置:

yum:192.168.4.10

client:192.168.4.30

1.首先本地yum源,把centos6 光驱里面的文件拷贝到yum源的机子上面;

2.配置本地yum源;

[root@yum ~]# yum clean all

Loaded plugins: fastestmirror, security

Cleaning repos: c6-media

Cleaning up Everything

Cleaning up list of fastest mirrors

[root@yum ~]# yum makecahce

Loaded plugins: fastestmirror, security

No such command: makecahce. Please use /usr/bin/yum –help

3. 安装nginx服务器;

1、 首先编译nginx;

./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --error-log-path=/data/log/nginx/error_log --http-log-path=/data/log/nginx/access_log --with-http_ssl_module --with-http_realip_module --with-http_flv_module --with-http_image_filter_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_stub_status_module

2、 Make&&make install;

4. Ngxin安装完成之后,配置nginx.conf文件;

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;

proxy_pass https://192.168.4.10;

}

#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 Apache's document root

# concurs with nginx's 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 on;

ssl_certificate /usr/local/nginx/server.pem;

ssl_certificate_key /usr/local/nginx/server.key;

ssl_session_cache shared:SSL:1m;

ssl_session_timeout 5m;

ssl_ciphers HIGH:!aNULL:!MD5;

ssl_prefer_server_ciphers on;

location / {

root /yum;

autoindex on;

}

}

5. 用windos主机访问192.168.4.10.。是否能正常访问主机;

6. 基于nginx的yum源搭建完成。

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
centOS7安装nginx及nginx配置
Nginx的泛域名绑定终于搞好了 - 火魔网
大型架构.net平台篇(WEB层均衡负载nginx)
nginx做负载均衡+keepalived(做主备)
Windows下Nginx的安装与配置
Nginx.conf 配置详解
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服