|
@@ -0,0 +1,51 @@
|
|
|
+user root root;
|
|
|
+#nginx进程,一般设置为和cpu核数一样
|
|
|
+worker_processes 2;
|
|
|
+#错误日志存放目录
|
|
|
+error_log /usr/local/openresty/nginx/logs/error.log crit;
|
|
|
+
|
|
|
+#进程pid存放位置
|
|
|
+pid /usr/local/openresty/nginx/logs/nginx.pid;
|
|
|
+
|
|
|
+#工作模式及连接数上限
|
|
|
+events
|
|
|
+{
|
|
|
+ use epoll; #epoll是多路复用IO(I/O Multiplexing)中的一种方式,但是仅用于linux2.6以上内核,可以大大提高nginx的性能
|
|
|
+ worker_connections 1024; #;单个后台worker process进程的最大并发链接数
|
|
|
+}
|
|
|
+
|
|
|
+http
|
|
|
+{
|
|
|
+ include mime.types; #文件扩展名与类型映射表
|
|
|
+ default_type application/octet-stream; #默认文件类型
|
|
|
+
|
|
|
+
|
|
|
+ #设置日志模式
|
|
|
+ log_format access '$remote_addr - $remote_user [$time_local] "$request" '
|
|
|
+ '$status $body_bytes_sent "$http_referer" '
|
|
|
+ '"$http_user_agent" $http_x_forwarded_for';
|
|
|
+
|
|
|
+
|
|
|
+ #基于域名的虚拟主机
|
|
|
+ server
|
|
|
+ {
|
|
|
+
|
|
|
+ #监听端口
|
|
|
+ listen 3000;
|
|
|
+ server_name 127.0.0.1;
|
|
|
+ #index index.html; #首页排序
|
|
|
+ #root /data0/abc; #站点根目录,即网站程序存放目录
|
|
|
+ #error_page 500 502 404 /templates/kumi/phpcms/404.html; #错误页面
|
|
|
+ #伪静态 将www.abc.com/list....html的文件转发到index.php。。。
|
|
|
+
|
|
|
+ location / {
|
|
|
+ rewrite '^/t/(.*)\.html$' /view/link/link.html?t=$1 last;
|
|
|
+ root /data;
|
|
|
+ index index.html;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ access_log /usr/local/openresty/nginx/logs/access.log access; #nginx访问日志
|
|
|
+
|
|
|
+ }
|
|
|
+}
|