We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
最近需要对网站的nginx进行配置,学习了下相关的知识。 需要解决的问题:
没有www的域名test.com指向到www.test.com 移动端自动指向到m.test.com上,pc上访问自动指向到www.test.com
对于第一个问题:
域名提供商管理页面进行相关配置,新增一个域名解析记录,记录类型为A记录,意思是说当用户输入test,com时候将转到ip为xx.xx.xx.xx的机器
设置相关机器的nginx配置,新增一条server记录
一般nginx的配置都在/usr/local/nginx/conf/
server { server_name test.com; rewrite ^/(.*)$ http://www.test.com/home_page permanent; root html; index index.html index.htm; }
对于第二个问题:
server { server_name test.com; if ( $http_user_agent ~* "(Android|webOS|iPhone|iPod|BlackBerry)" ) { rewrite ^/(.*)$ http://mobile.test.com/home_page permanent; } rewrite ^/(.*)$ http://www.test.com/home_page permanent; root html; index index.html index.htm; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
nginx配置学习篇
最近需要对网站的nginx进行配置,学习了下相关的知识。
需要解决的问题:
对于第一个问题:
一般nginx的配置都在/usr/local/nginx/conf/
对于第二个问题:
The text was updated successfully, but these errors were encountered: