web - nginx怎么绑定域名?
问题描述
rt,网上一搜都是多域名的做法,然而本着试一试的想法做了之后发现没用。。。特来询问一下怎么写配置文件才可以。。
问题解答
回答1:
它的配置文件很明确。你照着改就行了server_name 那里把localhost改成自己的域名就行了。
回答2:主配置文件
user huangyanxiong;worker_processes 1;error_log /var/log/nginx/error.log warn;pid/var/run/nginx.pid;events { worker_connections 1024;}http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main ’$remote_addr - $remote_user [$time_local] '$request' ’ ’$status $body_bytes_sent '$http_referer' ’ ’'$http_user_agent' '$http_x_forwarded_for'’; access_log /var/log/nginx/access.log main; sendfileon; #tcp_nopush on; keepalive_timeout 65; #gzip on; include /etc/nginx/conf.d/*.conf;}
包含的虚拟主机配置文件
log_format compression ’$remote_addr - $remote_user [$time_local] ’ ’'$request' $status $bytes_sent ’ ’'$http_referer' '$http_user_agent' '$gzip_ratio'’;#access_log /var/log/nginx/log/studyphome.access.log compression buffer=32k;server { listen 80; server_name www.mylaravel.com charset utf-8; #log_format compression ’$remote_addr - $remote_user [$time_local] ’ # ’'$request' $status $bytes_sent ’ # ’'$http_referer' '$http_user_agent' '$gzip_ratio'’; access_log /var/log/nginx/log/www.mylaravel.access.log compression buffer=32k; error_log /var/log/nginx/log/www.mylaravel.error.log; root/home/huangyanxiong/www/laravel/public; location / {#root /var/www/html;try_files $uri $uri/ /index.php?$query_string;index index.html index.htm index.php; } error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html {root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ .php$ { # proxy_pass http://127.0.0.1:8080; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ .php$ {#root html;fastcgi_pass 127.0.0.1:9090;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;includefastcgi_params; } location ~ ^/(images|javascript|js|css|flash|media|static)/ { #过期30天,静态文件不怎么更新,过期可以设大一点, #如果频繁更新,则可以设置得小一点。 expires 30d; } # deny access to .htaccess files, if Apache’s document root # concurs with nginx’s one # location ~ /.ht {deny all; }}回答3:
我怎么觉得是你的域名解析没有添加记录对应的记录呢
相关文章:
1. css3 - 一个关于CSS雪碧图的问题2. docker-machine添加一个已有的docker主机问题3. 如何解决Centos下Docker服务启动无响应,且输入docker命令无响应?4. 前端 - webpack如何打包script标签引入的代码5. Docker for Mac 创建的dnsmasq容器连不上/不工作的问题6. wordpress - nginx 反代 Varnish 走 Https ,WP后台 ‘您没有足够的权限访问该页面。’7. mac里的docker如何命令行开启呢?8. node.js - antdesign怎么集合react-redux对input控件进行初始化赋值9. css - 一条线两边有短线的样式表怎么写?10. 在bootstrap中怎么让浏览器缩小到一定大小时,里面的元素就不自适应屏幕大小,而是固定的大小。

网公网安备