- 反向代理
参考:https://www.vpser.net/manage/linux-vps-nginx-reverse-proxy.html
介绍:
反向代理简单来说就是访问 a.com,而显示的是 b.com 的内容。
配置文件:
server
{
listen 80;
server_name a.com;
location / {
proxy_pass http://b.com/;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
- typecho 伪静态
介绍:
伪静态通俗来说就是去掉网址中的 index.php
配置规则:
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php$1 last;
}
附:官方文档中的安装方法
链接:http://nginx.org/en/linux_packages.html
RHEL/CentOS
Install the prerequisites:
sudo yum install yum-utils
To set up the yum repository, create the file named /etc/yum.repos.d/nginx.repo with the following contents:
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
By default, the repository for stable nginx packages is used. If you would like to use mainline nginx packages, run the following command:
sudo yum-config-manager --enable nginx-mainline
To install nginx, run the following command:
sudo yum install nginx
When prompted to accept the GPG key, verify that the fingerprint matches 573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62, and if so, accept it.
评论关闭