Home Backend Development PHP Tutorial Detailed explanation of using Nginx to implement 301 redirection

Detailed explanation of using Nginx to implement 301 redirection

Jul 29, 2016 am 08:59 AM
header host proxy remote server

只需配置如下:

    server {
        listen       80;
        server_name  localhost;
	server_name_in_redirect off;
	proxy_set_header Host $host:$server_port;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header REMOTE-HOST $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	if ($host = 'www.xxx.com' ) {
	    rewrite ^/(.*)$ http://xxx.com/$1 permanent;
        }
	location / {
	    proxy_pass http://127.0.0.1:8080/;
        }
    }
Copy after login

以上就介绍了使用Nginx实现301重定向详解,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Windows 11 shutdown prompts task host window task host is executing the shutdown task solution Windows 11 shutdown prompts task host window task host is executing the shutdown task solution Feb 12, 2024 pm 12:40 PM

Recently, many Win11 users have reported that when shutting down, they are prompted that the taskhostwindow task host is executing the shutdown task. So what is going on? Users can enter the Desktop folder under the local registry editor, and then select AutoEndTasks in the right window to set it. Let this site carefully introduce to users the solution to this problem when shutting down. Windows 11 shutdown prompts that the taskhostwindow task host is executing the shutdown task. Solution 1. Use the key combination win key + r key, enter "regedit" and press Enter, as shown in the figure below. 2. Search for [HKEY

How to check if aggregator host.exe is safe in Windows 11 How to check if aggregator host.exe is safe in Windows 11 Apr 13, 2023 pm 04:22 PM

When we launch Task Manager to terminate a task or stop an application, we usually find a large number of processes running. This is completely normal. However, sometimes we see programs that are using system resources that we are completely unaware of. One of these processes is the aggregator host.exe, which has been causing some confusion among users recently. Some of these processes may be legitimate Windows requirements, but others may be malicious programs running in the background and causing problems without the user's knowledge or consent. After we've seen the five ways you can launch Task Manager in Windows 11, we'll show you how to check if aggregator host.exe is safe or a virus. keep up

Nginx Proxy Manager configuration analysis and optimization Nginx Proxy Manager configuration analysis and optimization Sep 26, 2023 am 09:24 AM

Overview of NginxProxyManager configuration analysis and optimization: NginxProxyManager is a reverse proxy management tool based on Nginx, which can help us easily configure and manage reverse proxy servers. In the process of using NginxProxyManager, we can improve the performance and security of the server by parsing and optimizing its configuration. Configuration analysis: Configuration file location and structure: NginxProxyManag

What to do if no route to host What to do if no route to host Oct 07, 2023 am 10:50 AM

The solutions to "no route to host" include checking the network connection, checking the IP address and port, checking the firewall configuration, checking the routing configuration, checking the network device configuration, checking the network service status, checking the network configuration and contacting the network administrator. Detailed introduction: 1. Check the network connection to ensure that the network connection between the client and the target host is normal. You can try to test network connectivity through the ping command or other network tools, and check whether hardware devices such as network cables, wireless networks, and routers are working properly. Make sure the network connection is stable, etc.

What is the difference between master and host What is the difference between master and host Sep 28, 2023 pm 01:34 PM

The differences between master and host are: 1. Host can play the role of client or server, while master is the central server responsible for coordinating and managing other slave servers in a distributed system; 2. Host is an ordinary computer device, and master usually has Higher processing power and resources are used to process and distribute tasks, manage data, and maintain the stability of the entire system; 3. The host is a node in the network, and the master is the server that plays a core role in the distributed system.

4 Quick Tips to Fix WMI Provider Host High CPU on Windows 11 4 Quick Tips to Fix WMI Provider Host High CPU on Windows 11 Apr 18, 2023 pm 08:25 PM

The WMIProviderHost process plays a vital role in Windows 11. It enables other applications to request information about your computer. Processes related to WMIProviderHost typically run in the background; therefore, they typically do not consume large amounts of system resources. However, the service reportedly uses more than 50% of CPU power at times due to other applications. It is worrisome to run your computer's processor at nearly maximum capacity for an extended period of time, as this can lead to overheating and damage to system components. In today's tutorial, we will look at why WMIProviderHost works in C on Windows 11

How to configure and use proxy protocol in nginx How to configure and use proxy protocol in nginx May 18, 2023 am 08:47 AM

When proxyprotocol is used in nginx, we know that nginx is a web server and proxy server. It generally works behind proxyserver or load balancing software (Haproxy, Amazon Elastic LoadBalancer (ELB)). The client first requests proxyserver or LSB load balancing software, and then to nginx Perform real web access. Because it has gone through multiple layers of software, some client information such as IP address, port number, etc. may be hidden, which is detrimental to our problem analysis and data statistics. Because for nginx, We want to be able to get real clients

What does linux header mean? What does linux header mean? Jul 18, 2023 pm 03:34 PM

The Linux header refers to the beginning of a file or data stream, which is used to contain metadata about the content. By correctly writing and using Header files, developers can better utilize system resources and improve code readability and Maintainability.

See all articles