- 安装nginx
- 配置nginx配置文件
[root@s4 nginx]# cat nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
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;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
upstream bk_radosgw
{
server 192.168.0.61:7480;
server 192.168.0.62:7480;
server 192.168.0.63:7480;
}
server
{
listen *:80;
location /
{
include fastcgi_params;
fastcgi_pass_header Authorization;
fastcgi_pass_request_headers on;
fastcgi_pass bk_radosgw;
}
}
}
第二个版本
[root@s4 nginx]# cat /etc/nginx/nginx.conf
#user nginx;
user root;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
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;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
upstream s3 {
server 192.168.1.61:7480 max_fails=5 fail_timeout=60s;
server 192.168.1.62:7480 max_fails=5 fail_timeout=60s;
server 192.168.1.63:7480 max_fails=5 fail_timeout=60s;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name s4;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location /{
proxy_pass http://s3;
}
}
}
问题1。
修改nginx.conf文件后,重启后出现的问题
nginx: [emerg] chown("/var/cache/nginx/client_temp", 0) failed (13: Permission denied)
解决方案:
# cd /var/cache/nginx/
# chown root ./* -R
问题2
修改以上问题后,出现了502错误,由于没有关闭selinux
解决方案:
SELINUX=enforcing 修改为
SELINUX=disabled