Nginx 踩坑日志

1.ngin.conf 公用配置文件:

# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.

events {
worker_connections 1024;
}

http {
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;

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;

include /etc/nginx/mime.types;
default_type application/octet-stream;

# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/配置文件目录地址/*.conf;

}

2.Nginx 常用指令:

nginx 启动 nginx -t 检查配置文件   nginx -s reload  重启服务

3.Nginx 子站设置(SSH):

server {
listen 443;
server_name canmeng.net;
ssl on;
ssl_certificate /SSH/1_canmeng.net_bundle.crt;
ssl_certificate_key /SSH/2_canmeng.net.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;

#access_log logs/host.access.log main;
location / {
root /WEB/B;  #路径
#wp规则
try_files $uri $uri/ /index.php?$args;

#指引index
index default.php index.php index.html index.htm;
#站点的rewrite在这里写
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
}
#错误页的配置
error_page 404 /error.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /WEB/B$fastcgi_script_name;   # File not found.PHP模块引导设置这里
include fastcgi_params;
}

}

4.Nginx子站设置:

server {
listen 80;
server_name canmeng.net;
#access_log logs/host.access.log main;
location / {
root /路径/BTZ;
index default.php index.php index.html index.htm;
#站点的rewrite全站跳HTTPS
#rewrite ^(.*) https://$host$1 permanent;
}
#错误页的配置
error_page 404 /error.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /WEB/B$fastcgi_script_name;
include fastcgi_params;
}

}

5.Nginx+PHP+mysql安装

yum install nginx -y

chkconfig nginx on  #开机启动

yum install mysql-server -y

service mysqld restart #启动mysql

/usr/bin/mysqladmin -u root password ‘MyPas$can4Wmeng_Press’  #密码

chkconfig mysqld on  #开机启动

yum install php-fpm php-mysql -y

service php-fpm start  #启动 PHP-FPM 进程

netstat -nlpt | grep php-fpm  #测试监听端口

chkconfig php-fpm on  #开机启动



240 thoughts on “Nginx 踩坑日志”

  • Fantastic beat ! I wish to apprentice while you amend your site, how can i subscribe for a blog website? The account helped me a acceptable deal. I had been tiny bit acquainted of this your broadcast provided bright clear idea

  • hello there and thank you for your info ? I?ve definitely picked up anything new from proper here. I did then again expertise several technical points the usage of this site, as I experienced to reload the website a lot of occasions previous to I may get it to load properly. I have been considering in case your web hosting is OK? Now not that I’m complaining, however slow loading cases times will sometimes have an effect on your placement in google and can damage your high quality ranking if ads and ***********|advertising|advertising|advertising and *********** with Adwords. Well I?m adding this RSS to my email and can look out for a lot extra of your respective fascinating content. Make sure you update this once more soon..

  • Oh my goodness! Impressive article dude! Thank you so much, However I am going through troubles with your RSS. I don’t know the reason why I can’t subscribe to it. Is there anybody having identical RSS issues? Anyone who knows the solution can you kindly respond? Thanx!!

  • Thanks for your writing. I would love to say that your health insurance specialist also works well with the benefit of the coordinators of your group insurance plan. The health agent is given a list of benefits desired by individuals or a group coordinator. Exactly what a broker really does is try to find individuals or maybe coordinators which best fit those demands. Then he provides his advice and if the two of you agree, the actual broker formulates a binding agreement between the two parties.

  • I do enjoy the manner in which you have presented this particular problem plus it really does offer us a lot of fodder for consideration. However, through just what I have personally seen, I really hope when other reviews pack on that individuals keep on point and not embark on a tirade involving some other news du jour. Yet, thank you for this excellent point and although I can not concur with the idea in totality, I regard the point of view.

  • I loved up to you’ll obtain performed proper here. The comic strip is attractive, your authored subject matter stylish. however, you command get bought an shakiness over that you would like be handing over the following. ill certainly come more formerly again since exactly the same nearly very steadily within case you shield this increase.

  • One thing I’ve noticed is the fact there are plenty of fallacies regarding the banking institutions intentions when talking about home foreclosure. One fairy tale in particular is that often the bank desires your house. The bank wants your hard earned cash, not your house. They want the cash they gave you together with interest. Preventing the bank will undoubtedly draw some sort of foreclosed realization. Thanks for your article.

  • An impressive share! I have just forwarded this onto a co-worker who was conducting a little homework on this. And he in fact bought me dinner because I discovered it for him… lol. So allow me to reword this…. Thank YOU for the meal!! But yeah, thanks for spending time to discuss this topic here on your web page.

  • FL Studio was created by Belgian business Image-Line. The music sequencer in FL Studio has a graphical user interface and is based on patterns. For both macOS and Microsoft Windows, there are four different editions of the app.

  • Thanks for your article. One other thing is that individual American states have their particular laws of which affect property owners, which makes it very difficult for the the legislature to come up with the latest set of recommendations concerning foreclosure on people. The problem is that every state offers own legislation which may have impact in an adverse manner in terms of foreclosure insurance policies.

  • Thanks for your write-up. I also think laptop computers have gotten more and more popular right now, and now are often the only sort of computer used in a household. This is because at the same time potentially they are becoming more and more reasonably priced, their computing power is growing to the point where these are as effective as pc’s through just a few in years past.

  • Thank you for the good writeup. It in fact was a amusement account it. Look advanced to far added agreeable from you! However, how could we communicate?

  • I’m really inspired with your writing skills as neatly as with the structure for your blog. Is that this a paid subject matter or did you customize it yourself? Anyway stay up the excellent high quality writing, it?s rare to peer a nice weblog like this one these days..

  • You can certainly see your skills in the work you write. The world hopes for even more passionate writers like you who aren’t afraid to say how they believe. Always go after your heart.

  • Hello there! This article couldn’t be written any better! Reading through this post reminds me of my previous roommate! He continually kept talking about this. I’ll forward this information to him. Fairly certain he’s going to have a great read. Thank you for sharing!

  • I’m pretty pleased to find this great site. I need to to thank you for your time for this fantastic read!! I definitely appreciated every part of it and i also have you bookmarked to look at new stuff on your blog.

  • Greetings! Very helpful advice within this article! It is the little changes that make the most significant changes. Many thanks for sharing!

  • I’m really impressed with your writing skills as neatly as with the structure on your blog. Is that this a paid topic or did you modify it yourself? Anyway keep up the nice quality writing, it is uncommon to see a nice weblog like this one these days..

  • Thanks for the different tips contributed on this blog. I have noticed that many insurance agencies offer customers generous reductions if they decide to insure more and more cars together. A significant quantity of households currently have several motor vehicles these days, particularly people with old teenage young children still living at home, as well as savings on policies might soon increase. So it will pay to look for a bargain.

  • What?s Going down i am new to this, I stumbled upon this I have discovered It positively useful and it has helped me out loads. I’m hoping to contribute & assist other customers like its aided me. Great job.

  • you’re truly a good webmaster. The web site loading velocity is amazing. It seems that you are doing any distinctive trick. Also, The contents are masterpiece. you have performed a magnificent job on this matter!

  • Its like you read my mind! You seem to know a lot about this, like you wrote the book in it or something. I think that you can do with a few pics to drive the message home a bit, but other than that, this is magnificent blog. An excellent read. I’ll certainly be back.

  • I additionally believe that mesothelioma cancer is a unusual form of cancer malignancy that is typically found in people previously exposed to asbestos. Cancerous cells form inside the mesothelium, which is a shielding lining which covers almost all of the body’s areas. These cells commonly form within the lining on the lungs, abdomen, or the sac which encircles one’s heart. Thanks for expressing your ideas.

  • Thanks for your writing. I would love to say that your health insurance broker also works best for the benefit of the particular coordinators of the group insurance policy. The health insurance professional is given a long list of benefits needed by someone or a group coordinator. What a broker really does is look for individuals or perhaps coordinators which often best match those needs. Then he gifts his tips and if each party agree, this broker formulates a contract between the two parties.

  • I am very satisfied of this website and I also rate it daily whenever I do and my whole family is also very agree with this website. I like it so much. i am satisfied.

发表评论

邮箱地址不会被公开。 必填项已用*标注

87 − 78 =