在Debian或Ubuntu上为Apache主服务器设置Nginx反向代理
文章目录[隐藏]
Nginx是一个轻量级的Web服务器,已被证明比Apache更快地提供静态文件。本教程将指导您如何将Nginx配置为反向代理,使其与Apache配合工作。
要求
您已在服务器上安装了Apache。Apache已经在端口80上运行一个站点。
更改Apache侦听端口
编辑/etc/apache2/ports.conf
以使Apache监听端口8080而不是默认端口80。
查找以下行:
NameVirtualHost *:80
Listen 80
将其更改为:
NameVirtualHost *:8080
Listen 8080
不要忘记/etc/apache2/sites-enabled/*
现有vhost侦听端口
更改:
<VirtualHost *:80>
至:
<VirtualHost *:8080>
在Apache中禁用Unuse模块
由于HTTP请求现在由Nginx处理,我们可以在Apache.Edit /etc/apache2/apache2.conf
禁用KeepAlive并更改:
KeepAlive Off
另外,运行以下命令禁用不再需要的模块。
a2dismod deflate
a2dismod cgi
a2dismod autoindex
a2dismod negotiation
a2dismod ssl
安装转发模块
在Apache中安装mod_rpaf以将访客IP转发给Apache。否则,您的脚本将读取REMOTE_ADDR值作为服务器IP。
apt-get install libapache2-mod-rpaf
停止Apache服务
/etc/init.d/apache2 restart
设置Nginx
安装Nginx。
apt-get install nginx
删除默认虚拟主机以防止冲突。
rm -rf /etc/nginx/sites-enabled/*
创建一个新的默认虚拟主机:
cat >/etc/nginx/sites-available/000-default <<EOF
server {
access_log off;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8080;
}
}
EOF
ln -s /etc/nginx/sites-available/000-default /etc/nginx/sites-enabled/000-default
为现有网站创建虚拟主机以将请求转发给Apache:
cat >/etc/nginx/sites-available/domain.com <<EOF
server {
server_name www.domain.com domain.com;
root /var/www/domain.com/;
access_log off;
# Static contents
location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ {
expires max;
}
# Dynamic content, forward to Apache
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8080;
}
}
EOF
ln -s /etc/nginx/sites-available/domain.com /etc/nginx/sites-enabled/domain.com
重新启动Nginx并完成。
/etc/init.d/nginx restart
pgstptnetg
九月 26, 2020 12:44 下午
在Debian或Ubuntu上为Apache主服务器设置Nginx反向代理
[url=http://www.gl934417a4sw491l5bp86a1bjpvp3bs9s.org/]upgstptnetg[/url]
apgstptnetg
pgstptnetg http://www.gl934417a4sw491l5bp86a1bjpvp3bs9s.org/
1 Inch Wire Mesh Fencing
十月 8, 2020 9:29 下午
1 Inch Wire Mesh Fencing
Camlock Coupling Type C
十月 9, 2020 1:47 上午
Camlock Coupling Type C
CYCLING clothes
十月 9, 2020 3:44 上午
CYCLING clothes
98 Interactive Display
十月 9, 2020 5:12 上午
98 Interactive Display
Breathable Mouth Mask
十月 9, 2020 7:21 上午
Breathable Mouth Mask
Industrial Laser Marking Equipment
十月 9, 2020 7:57 上午
Industrial Laser Marking Equipment
Laser Marking Engraving Machine
十月 9, 2020 11:45 上午
Laser Marking Engraving Machine
12mm Steel Pipe
十月 9, 2020 7:26 下午
12mm Steel Pipe
Galvanize Anchor Bolts
十月 9, 2020 9:49 下午
Galvanize Anchor Bolts
120ml Plastics Lotion Pump Bottle
十月 10, 2020 1:02 上午
120ml Plastics Lotion Pump Bottle
Digital Writing Board For Classroom
十月 10, 2020 3:51 上午
Digital Writing Board For Classroom
Calacatta Marble White
十月 10, 2020 5:42 上午
Calacatta Marble White
Carlsberg Beer Can
十月 10, 2020 9:24 上午
Carlsberg Beer Can
Arm Exercise Equipment
十月 10, 2020 11:31 上午
Arm Exercise Equipment
100% Cotton Mens Polo Shirt
十月 10, 2020 9:31 下午
100% Cotton Mens Polo Shirt
Big Storage Jars
十月 11, 2020 1:48 上午
Big Storage Jars
3 Axis Milling Machine
十月 11, 2020 3:01 上午
3 Axis Milling Machine
Commercial Elliptical
十月 11, 2020 3:56 上午
Commercial Elliptical
LED Panel light
十月 11, 2020 8:01 上午
LED Panel light
Cheap Drawer Cabinet
十月 11, 2020 9:58 上午
Cheap Drawer Cabinet
Blouses & tops
十月 11, 2020 7:14 下午
Blouses & tops
Germany
十月 11, 2020 9:28 下午
Germany
30 Gauge Stainless Steel Wire
十月 11, 2020 11:14 下午
30 Gauge Stainless Steel Wire
Pump Valves
十月 11, 2020 11:51 下午
Pump Valves
Products
十月 12, 2020 1:05 上午
Products
Hand Boating For Sale
十月 12, 2020 1:59 上午
Hand Boating For Sale
Bloody Wound Drainage
十月 12, 2020 3:27 上午
Bloody Wound Drainage
Mason Cup With Handle
十月 12, 2020 3:56 上午
Mason Cup With Handle
Husky Slippers
十月 12, 2020 7:04 上午
Husky Slippers
500 Mesh Filter
十月 12, 2020 9:05 上午
500 Mesh Filter
Hoti Horticul Grow Light
十月 12, 2020 9:26 上午
Hoti Horticul Grow Light
3D Ceramic Wall Tiles
十月 12, 2020 9:38 上午
3D Ceramic Wall Tiles
Hobby Laser Cutting Machine
十月 12, 2020 11:12 上午
Hobby Laser Cutting Machine
3 Ply Mask
十月 12, 2020 11:24 上午
3 Ply Mask
4mm Tungsten Carbide Ball
十月 12, 2020 5:24 下午
4mm Tungsten Carbide Ball
Carbide Bar
十月 13, 2020 1:25 上午
Carbide Bar
Pillow Type Packaging Machine
十月 13, 2020 11:08 上午
Pillow Type Packaging Machine
Custom Hoop Earring
十月 14, 2020 1:15 上午
Custom Hoop Earring
Disposable Non Woven Face Mask
十月 14, 2020 9:40 上午
Disposable Non Woven Face Mask
China Halloween and Horror price
十月 14, 2020 10:28 上午
China Halloween and Horror price
Cabinet Door Stops
十月 15, 2020 5:52 上午
Cabinet Door Stops
Irrigation Valve
十月 15, 2020 7:50 上午
Irrigation Valve
Wall Hanging
十月 15, 2020 9:31 上午
Wall Hanging
A3 Hardcover Book Printing
十月 16, 2020 5:03 上午
A3 Hardcover Book Printing
1flute End Mill
十月 17, 2020 7:14 上午
1flute End Mill
Bake Oven Conveyor Band
十月 17, 2020 8:49 上午
Bake Oven Conveyor Band
100 W High Bay Suppliers for Sale
十月 17, 2020 11:12 上午
100 W High Bay Suppliers for Sale
19w4 Grating Machine
十月 18, 2020 2:35 上午
19w4 Grating Machine
Desktop Laser Cutter
十月 18, 2020 3:43 上午
Desktop Laser Cutter
Featured
十月 18, 2020 5:08 上午
Featured
1.2m Led Batten Fittings
十月 18, 2020 5:35 上午
1.2m Led Batten Fittings
201 hot rolled stainless steel coil
十月 18, 2020 9:00 上午
201 hot rolled stainless steel coil
Benq Interactive Flat Panel Video
十月 18, 2020 9:27 上午
Benq Interactive Flat Panel Video
Beach tent/shelter
十月 18, 2020 10:24 上午
Beach tent/shelter
Adult Teddy Bear Costumes
十月 18, 2020 5:42 下午
Adult Teddy Bear Costumes
Hex flange head self drilling screw
十月 18, 2020 7:31 下午
Hex flange head self drilling screw
12v Hydraulic Power Units
十月 18, 2020 9:20 下午
12v Hydraulic Power Units
Chestnut Laminate Flooring
十月 19, 2020 3:15 上午
Chestnut Laminate Flooring
100w Fabric Layer Cutting Machine
十月 19, 2020 3:52 上午
100w Fabric Layer Cutting Machine
1 Inch Steel Tubing
十月 19, 2020 1:08 下午
1 Inch Steel Tubing
acute care beds
十月 19, 2020 11:22 下午
acute care beds
Chemical Stabilizer-cmc
十月 20, 2020 5:21 上午
Chemical Stabilizer-cmc
Hiking Industry Co., Limited
十月 20, 2020 5:55 下午
Hiking Industry Co., Limited
5 Persons Residential Indoor Home Villa Elevator - Elevator
十月 21, 2020 1:52 上午
5 Persons Residential Indoor Home Villa Elevator – Elevator
Jiangxi Normal University
十月 21, 2020 3:10 上午
Jiangxi Normal University
bikini
十月 21, 2020 3:32 上午
bikini
Guangzhou Baoyue Electromechanical Equipment Co., Ltd.
十月 22, 2020 7:28 上午
Guangzhou Baoyue Electromechanical Equipment Co., Ltd.
Hormone Growth
十月 22, 2020 7:57 上午
Hormone Growth
1 Cm Sprei Satin Stripe
十月 22, 2020 9:59 上午
1 Cm Sprei Satin Stripe
Hpmc For Mortar Factory
十月 22, 2020 11:18 下午
Hpmc For Mortar Factory
Hook And Eye Price
十月 24, 2020 6:01 上午
Hook And Eye Price
Hefei Easy Way Imp & Exp Co., Ltd.
十月 25, 2020 9:12 下午
Hefei Easy Way Imp & Exp Co., Ltd.
Health Mask
十月 26, 2020 5:07 上午
Health Mask
150w Laser Cutting Machine
十月 26, 2020 7:53 上午
150w Laser Cutting Machine
Henan Forchen Machinery Co., Ltd.
十月 26, 2020 7:56 下午
Henan Forchen Machinery Co., Ltd.
Heat Plate
十月 27, 2020 3:41 上午
Heat Plate
Bed Elevator Lift
十月 27, 2020 11:18 上午
Bed Elevator Lift
Hefei Huanxin Technology Development Co., Ltd.
十月 28, 2020 11:07 上午
Hefei Huanxin Technology Development Co., Ltd.
Air-blown optical cable
十月 28, 2020 7:29 下午
Air-blown optical cable
GREAT WALL VOLEEX C20R
十月 29, 2020 1:56 上午
GREAT WALL VOLEEX C20R
Molybdenum Alloy Factory
十月 29, 2020 7:40 下午
Molybdenum Alloy Factory
4 Flute Ball Nose End Mill
十月 30, 2020 7:44 上午
4 Flute Ball Nose End Mill
Eyeshadow Makeup
十月 31, 2020 1:52 上午
Eyeshadow Makeup
Automatic Glue Filling Machine
十月 31, 2020 7:10 上午
Automatic Glue Filling Machine
Handbags Bags Production Price
十月 31, 2020 7:41 下午
Handbags Bags Production Price
50cc Air Filters
十一月 1, 2020 5:38 上午
50cc Air Filters
Beijing Normal University
十一月 1, 2020 9:22 上午
Beijing Normal University
adult pull up
十一月 1, 2020 7:08 下午
adult pull up
Line Array Price
十一月 2, 2020 3:26 上午
Line Array Price
Anti Theft Backpack
十一月 2, 2020 5:49 下午
Anti Theft Backpack Supplier
China Biaxially Oriented Polypropylene
十一月 2, 2020 9:07 下午
Biaxially Oriented Polypropylene Supplier
Notebook
十一月 3, 2020 1:09 上午
Notebook
Cooling Device
十一月 3, 2020 5:20 上午
Cooling Device
Fiber Cable
十一月 3, 2020 9:36 上午
Fiber Cable
Hand Grease Gun Price
十一月 4, 2020 11:30 上午
Hand Grease Gun Price
Mask Respirator
十一月 4, 2020 9:30 下午
Mask Respirator
Camlock F
十一月 5, 2020 1:22 上午
Camlock F
China Mesh Office Computer Swivel Desk Task Chair
十一月 5, 2020 8:42 上午
Mesh Office Computer Swivel Desk Task Chair Supplier
China Cosmetic Lotion Pump
十一月 5, 2020 5:10 下午
Cosmetic Lotion Pump
China Dining table and chair
十一月 6, 2020 8:38 上午
Dining table and chair Supplier
Automatic Glass Drilling Machine
十一月 6, 2020 11:59 上午
Automatic Glass Drilling Machine
4 Head Filling Machine
十一月 7, 2020 11:29 上午
4 Head Filling Machine
欧美性爱视频
十一月 7, 2020 11:47 下午
欧美牲交AⅤ
在线赌场游戏
十一月 8, 2020 1:31 上午
欧美牲交AⅤ
Vertical Slatwall Supplier
十一月 8, 2020 1:19 下午
China Vertical Slatwall
Ho Scale Train Couplers
十一月 9, 2020 2:30 上午
Ho Scale Train Couplers
Home Equipment
十一月 9, 2020 11:48 上午
Home Equipment
赌厅网投
十一月 10, 2020 6:45 上午
欧美牲交AⅤ
Circuit Board Trace
十一月 11, 2020 11:45 上午
Circuit Board Trace
Hair Accessory Price
十一月 12, 2020 3:09 上午
Hair Accessory Price
China Leather Sofa
十一月 13, 2020 7:10 上午
Leather Sofa Supplier
1000 Extractor Hood
十一月 13, 2020 11:01 下午
1000 Extractor Hood
https://www.deliworld.com/adhesive-products/e811-tape-dispenser-small.html
十一月 14, 2020 3:25 下午
https://www.deliworld.com/adhesive-products/e811-tape-dispenser-small.html
Air Filter For Screw Compressor
十一月 14, 2020 5:50 下午
Air Filter For Screw Compressor
China Cold Water Booster Pump And Tank
十一月 16, 2020 1:37 上午
China Cold Water Booster Pump And Tank
Led Panel Light Ceiling Supplier
十一月 16, 2020 4:17 上午
Led Panel Light Ceiling Supplier
300mm Shock Absorber
十一月 16, 2020 9:11 上午
300mm Shock Absorber
4 Port Managed Industrial Switch
十一月 17, 2020 9:22 上午
4 Port Managed Industrial Switch
Balloon Gastrostomy Tube
十一月 17, 2020 11:23 上午
Balloon Gastrostomy Tube
11421711568 Oil Filter
十一月 18, 2020 3:12 上午
11421711568 Oil Filter
Bwg17 Galvanized Iron Wire
十一月 18, 2020 3:43 上午
Bwg17 Galvanized Iron Wire
Adult Mini Cruiser Skateboard
十一月 18, 2020 5:18 上午
Adult Mini Cruiser Skateboard
04152-31090
十一月 18, 2020 6:23 上午
04152-31090
China Security Fencing
十一月 18, 2020 7:32 上午
China Security Fencing Supplier
Beer Valve
十一月 18, 2020 9:05 上午
Beer Valve
China Flower Lapel Pin
十一月 18, 2020 5:23 下午
China Flower Lapel Pin
common rail injector valve plate
十一月 19, 2020 9:13 上午
common rail injector valve plate
Fixing Screws
十一月 19, 2020 9:10 下午
Fixing Screws
Canada Steel Plank
十一月 20, 2020 9:19 上午
Canada Steel Plank
Elastic Woven Tape
十一月 21, 2020 5:26 上午
Elastic Woven Tape
Porous Vent
十一月 21, 2020 7:54 上午
Porous Vent
china electric bicycle factory
十一月 21, 2020 6:30 下午
china electric bicycle factory
Bulk Tin Containers
十一月 21, 2020 9:53 下午
Bulk Tin Containers
Android Smart Tv
十一月 22, 2020 7:16 上午
Android Smart Tv
Automatic Glass Cleaner
十一月 23, 2020 12:00 上午
Automatic Glass Cleaner
Carbon Steel Plate
十一月 23, 2020 5:52 上午
Carbon Steel Plate
4k Camera Cable
十一月 23, 2020 9:03 上午
4k Camera Cable
Aluminum Motorcycle Parts
十一月 25, 2020 10:37 下午
Aluminum Motorcycle Parts
Hyaluronic Acid Knee Injection
十一月 26, 2020 1:32 上午
Hyaluronic Acid Knee Injection
Hatching Egg Packer
十一月 26, 2020 11:07 上午
Hatching Egg Packer
Banana Plug For Ecg
十一月 26, 2020 7:31 下午
Banana Plug For Ecg
Black Bench
十一月 27, 2020 7:10 上午
Black Bench
Generator With Compass
十一月 27, 2020 7:52 上午
Generator With Compass
China Perforated Carved Aluminum Panel
十一月 27, 2020 9:37 上午
China Perforated Carved Aluminum Panel
Bird Figurine For Sale
十一月 27, 2020 11:34 上午
Bird Figurine For Sale
China Ppgi
十一月 27, 2020 1:53 下午
China Ppgi
Insulated Cable Connector
十一月 28, 2020 1:41 上午
Insulated Cable Connector
Blue Light Blocking Safety Glasses
十一月 28, 2020 3:23 上午
Blue Light Blocking Safety Glasses
China prefab house
十一月 28, 2020 7:33 上午
China prefab house
Barbie Hair Band
十一月 28, 2020 11:02 上午
Barbie Hair Band
Henan Forchen Machinery Co., Ltd.
十一月 28, 2020 9:59 下午
Henan Forchen Machinery Co., Ltd.
7 /croscarmellose Sodium - 74811-65-7
十一月 29, 2020 5:45 下午
7 /croscarmellose Sodium – 74811-65-7
21.5 Inch Ultra-slim All In One Pc
十一月 29, 2020 9:28 下午
21.5 Inch Ultra-slim All In One Pc
日本AV性爱电影
十一月 29, 2020 11:42 下午
在线赌场游戏
Stump Grinding Machine
十一月 30, 2020 11:14 上午
Stump Grinding Machine
E Scooter Taiwan
十一月 30, 2020 1:10 下午
E Scooter Taiwan
Alpha Lipoic Acid Reviews
十二月 1, 2020 3:55 上午
Alpha Lipoic Acid Reviews
Floor Drain And Cleanouts
十二月 1, 2020 4:25 上午
Floor Drain And Cleanouts
Hand Control For Hospital Bed Supplier
十二月 2, 2020 3:36 上午
China Hand Control For Hospital Bed
Hand Pump
十二月 3, 2020 1:01 上午
Hand Pump
2oz Skin Care Cream Glass Container
十二月 4, 2020 7:49 上午
2oz Skin Care Cream Glass Container
Waterproof Materials Products
十二月 4, 2020 3:38 下午
Waterproof Materials Products
Movable Acoustic Walls Supplier
十二月 5, 2020 3:56 上午
Movable Acoustic Walls Supplier
Bathing Trunks
十二月 5, 2020 5:35 上午
China Bathing Trunks
Table Polishing Machine
十二月 6, 2020 1:43 上午
Table Polishing Machine
Automatic block making machine
十二月 7, 2020 7:59 下午
Automatic block making machine
Oversized Zero Gravity Chair
十二月 8, 2020 1:48 上午
Oversized Zero Gravity Chair
快车足彩
十二月 8, 2020 3:57 上午
快车足彩
Bed Knives
十二月 8, 2020 7:42 上午
Bed Knives