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  #开机启动



239 thoughts on “Nginx 踩坑日志”

  • I have observed that in the world the present day, video games will be the latest phenomenon with children of all ages. Often times it may be not possible to drag your children away from the activities. If you want the best of both worlds, there are several educational games for kids. Interesting post.

  • I just could not leave your site before suggesting that I extremely enjoyed the usual information a person provide on your visitors? Is gonna be again ceaselessly to investigate cross-check new posts

  • Thanks , I’ve recently been looking for information about this topic for ages and yours is the best I have found out so far. However, what about the conclusion? Are you positive concerning the source?

  • Hey There. I found your weblog the use of msn. That is a very smartly written article. I?ll be sure to bookmark it and come back to read more of your useful info. Thank you for the post. I will definitely comeback.

  • hello there and thank you for your info ? I have definitely picked up anything new from right here. I did however expertise a few technical points using this web site, since I experienced to reload the website lots of times previous to I could get it to load properly. I had been wondering if your hosting is OK? Not that I’m complaining, but sluggish loading instances times will very frequently affect your placement in google and could damage your high-quality score if advertising and marketing with Adwords. Well I am adding this RSS to my email and can look out for much more of your respective exciting content. Make sure you update this again soon..

  • What i don’t realize is in truth how you are not really a lot more well-favored than you might be right now. You’re so intelligent. You recognize thus significantly in relation to this subject, made me in my view consider it from a lot of varied angles. Its like women and men are not involved except it?s one thing to accomplish with Lady gaga! Your personal stuffs outstanding. At all times take care of it up!

  • I have learned newer and more effective things from your blog post. One more thing to I have found is that usually, FSBO sellers will certainly reject you actually. Remember, they can prefer not to ever use your services. But if you actually maintain a reliable, professional relationship, offering help and keeping contact for around four to five weeks, you will usually be able to win a business interview. From there, a house listing follows. Many thanks

  • Interesting blog post. Things i would like to bring about is that pc memory needs to be purchased when your computer cannot cope with what you do by using it. One can mount two random access memory boards having 1GB each, for instance, but not certainly one of 1GB and one of 2GB. One should check the manufacturer’s documentation for the PC to make certain what type of memory space is required.

  • Hello very cool site!! Man .. Excellent .. Wonderful .. I’ll bookmark your website and take the feeds also?I am happy to seek out a lot of useful information here within the put up, we need develop more strategies on this regard, thank you for sharing. . . . . .

  • I have observed that clever real estate agents all over the place are Advertising. They are acknowledging that it’s not only placing a sign in the front yard. It’s really with regards to building associations with these suppliers who sooner or later will become consumers. So, when you give your time and efforts to helping these sellers go it alone — the “Law connected with Reciprocity” kicks in. Thanks for your blog post.

  • Yet another thing to mention is that an online business administration training is designed for students to be able to without problems proceed to bachelors degree programs. The 90 credit certification meets the lower bachelor college degree requirements and once you earn your own associate of arts in BA online, you will have access to the most recent technologies within this field. Some reasons why students need to get their associate degree in business is because they can be interested in this area and want to get the general education necessary just before jumping in to a bachelor college diploma program. Thanks alot : ) for the tips you provide in your blog.

  • I do enjoy the manner in which you have presented this challenge and it does present me some fodder for thought. Nevertheless, through everything that I have experienced, I basically wish as the feedback stack on that folks stay on issue and not embark upon a soap box regarding some other news du jour. Still, thank you for this excellent piece and even though I can not go along with the idea in totality, I regard your perspective.

  • I haven?t checked in here for some time since I thought it was getting boring, but the last few posts are great quality so I guess I will add you back to my everyday bloglist. You deserve it my friend 🙂

  • One thing I’d like to say is car insurance cancellations is a terrifying experience and if you are doing the best things like a driver you may not get one. A lot of people do have the notice that they have been officially dumped by their insurance company and many have to fight to get more insurance from a cancellation. Low-cost auto insurance rates are often hard to get after the cancellation. Having the main reasons concerning the auto insurance termination can help drivers prevent getting rid of in one of the most significant privileges accessible. Thanks for the suggestions shared by means of your blog.

  • Thanks for the thoughts you have provided here. In addition, I believe there are many factors that really keep your car insurance premium straight down. One is, to contemplate buying cars and trucks that are in the good report on car insurance providers. Cars that happen to be expensive will be more at risk of being stolen. Aside from that insurance is also using the value of your automobile, so the more pricey it is, then the higher the actual premium you spend.

  • After checking out a number of the articles on your web page, I truly like your way of writing a blog. I bookmarked it to my bookmark site list and will be checking back soon. Please visit my website as well and tell me what you think.

  • An outstanding share! I’ve just forwarded this onto a friend who was doing a little research on this. And he actually ordered me dinner simply because I found it for him… lol. So let me reword this…. Thank YOU for the meal!! But yeah, thanks for spending time to discuss this matter here on your web page.

  • It is appropriate time to make some plans for the future and it is time to be happy. I’ve read this post and if I could I wish to suggest you some interesting things or tips. Perhaps you can write next articles referring to this article. I want to read more things about it!

  • Hi there, simply became alert to your weblog via Google, and located that it’s truly informative. I?m gonna watch out for brussels. I will be grateful if you proceed this in future. Many other people will probably be benefited out of your writing. Cheers!

  • One thing I’d prefer to say is before purchasing more computer memory, look at the machine directly into which it is installed. In case the machine is definitely running Windows XP, for instance, the particular memory threshold is 3.25GB. The installation of over this would purely constitute a new waste. Make sure that one’s motherboard can handle the actual upgrade amount, as well. Thanks for your blog post.

  • I’m amazed, I must say. Seldom do I come across a blog that’s both educative and entertaining, and let me tell you, you’ve hit the nail on the head. The problem is something too few people are speaking intelligently about. Now i’m very happy I came across this in my hunt for something regarding this.

  • A few things i have often told people today is that when evaluating a good internet electronics retail store, there are a few aspects that you have to remember to consider. First and foremost, you want to make sure to find a reputable along with reliable shop that has picked up great critiques and rankings from other individuals and business world professionals. This will ensure that you are getting along with a well-known store that provides good assistance and assistance to it’s patrons. Thanks for sharing your notions on this website.

  • Generally I do not learn article on blogs, but I would like to say that this write-up very compelled me to try and do so! Your writing style has been amazed me. Thank you, quite great article.

  • Pretty component to content. I just stumbled upon your blog and in accession capital to claim that I get in fact loved account your blog posts. Anyway I?ll be subscribing in your feeds or even I fulfillment you get right of entry to constantly fast.

  • Very nice post. I just stumbled upon your weblog and wished to say that I have truly enjoyed surfing around your blog posts. After all I?ll be subscribing to your rss feed and I hope you write again very soon!

  • Someone essentially assist to make critically posts I would state. That is the very first time I frequented your website page and thus far? I amazed with the analysis you made to create this actual post amazing. Great task!

  • Nice blog here! Also your website loads up very fast! What web host are you using? Can I get your affiliate link to your host? I wish my website loaded up as quickly as yours lol

  • Good post. I learn one thing tougher on totally different blogs everyday. It should all the time be stimulating to learn content material from other writers and follow a bit of one thing from their store. I?d favor to make use of some with the content on my weblog whether or not you don?t mind. Natually I?ll give you a hyperlink on your web blog. Thanks for sharing.

  • I additionally believe that mesothelioma cancer is a uncommon form of melanoma that is normally found in these previously familiar with asbestos. Cancerous cells form inside mesothelium, which is a defensive lining that covers a lot of the body’s internal organs. These cells usually form from the lining with the lungs, abdominal area, or the sac that encircles the heart. Thanks for sharing your ideas.

  • I have discovered that smart real estate agents just about everywhere are Advertising. They are acknowledging that it’s in addition to placing a sign post in the front yard. It’s really pertaining to building connections with these sellers who one of these days will become buyers. So, when you give your time and energy to aiding these suppliers go it alone — the “Law of Reciprocity” kicks in. Interesting blog post.

  • Oh my goodness! an incredible article dude. Thanks Nonetheless I am experiencing problem with ur rss . Don?t know why Unable to subscribe to it. Is there anyone getting identical rss drawback? Anyone who is aware of kindly respond. Thnkx

发表评论

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

+ 52 = 53