Skip to content

@wxianfeng /lecai360_com.conf
Last active

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
nginx config domain
# lecai360.com ,www.lecai360.com 分别独立访问
server{
listen 80;
server_name lecai360.com www.lecai360.com;
root /web/projects/lecai/current/public;
passenger_enabled on;
}
# http://ronbin.com/311.htm?replytocom=245
# nginx反向代理后端的 wordpress(apache+php),wp地址是 http://wxianfeng.com:8080
# 前端地址 http://www.vic360.com
# nginx配置
upstream vic360_com {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name www.vic360.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_redirect off;
if (!-f $request_filename){
proxy_pass http://vic360_com;
break;
}
}
}
# apache 配置
>vi /etc/httpd/conf/httpd.conf
Listen 8080
NameVirtualHost *:8080
<VirtualHost *:8080>
ServerName www.vic360.com
DocumentRoot /usr/local/system/www/vic360
<Directory />
Options FollowSymLinks
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
# 配置 https://wxianfeng.com
# 注意编译nginx时加上 --with-http_ssl_module , 如果当初忘记, 可重新编译
upstream wxianfeng_com {
server 127.0.0.1:3000;
server 127.0.0.1:3001;
server 127.0.0.1:3002;
}
server {
listen 80;
server_name www.wxianfeng.com;
rewrite ^/(.*) http://wxianfeng.com/$1 permanent;
}
server {
listen 80;
server_name wxianfeng.com;
access_log /usr/local/system/nginx/logs/access.log;
error_log /usr/local/system/nginx/logs/error.log;
root /usr/local/system/www/wxianfeng_com/current/public/;
index index.html;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://wxianfeng_com;
break;
}
}
}
upstream ssl {
server 127.0.0.1:80;
}
server {
server_name wxianfeng.com;
listen 443;
ssl on;
ssl_certificate /usr/local/system/nginx/conf/server.crt;
ssl_certificate_key /usr/local/system/nginx/conf/server.key;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host wxianfeng.com;
proxy_redirect off;
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://ssl;
break;
}
}
}
# store.lecai360.com 反向代理访问
upstream store_lecai360_com {
server 192.168.66.10:80;
}
server {
listen 80;
server_name store.lecai360.com;
access_log /usr/local/nginx/logs/access.log;
error_log /usr/local/nginx/logs/error.log;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host store.lecai360.com;
proxy_redirect off;
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://store_lecai360_com;
break;
}
}
}
# www.wxianfeng.com rewrite to wxianfeng.com
upstream wxianfeng_com {
server 127.0.0.1:3000;
server 127.0.0.1:3001;
server 127.0.0.1:3002;
}
server {
listen 80;
server_name www.wxianfeng.com;
rewrite ^/(.*) http://wxianfeng.com/$1 permanent;
}
server {
listen 80;
server_name wxianfeng.com;
access_log /usr/local/system/nginx/logs/access.log;
error_log /usr/local/system/nginx/logs/error.log;
root /usr/local/system/www/wxianfeng_com/current/public/;
index index.html;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://wxianfeng_com;
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.