centos6.x Installation Configuration Nginx

Source: Internet
Author: User
Tags ssl certificate nginx ssl

Nginx Installation

Nginx official website: http://nginx.org/corresponding download page: http://nginx.org/en/download.html I use the nginx yum online installation here

wget http://nginx.org/packages/centos/6/noarch/rpms/nginx-release-centos-6-0.el6.ngx.noarch.rpm

Install Source Library

chmod +x nginx-release-CentOS-6-0.el6.ngx. Noarch. RPM

RPM -i nginx-release-CentOS-6-0.el6.ngx. Noarch. RPM

Installing Nginx

Yum Install Nginx

After the installation is complete, the default Nginx profile:/etc/nginx/nginx.conf "Nginx main profile" default Nginx SSL configuration file:/etc/nginx/conf.d/ssl.conf "Configuration SSL certificate, can also be incorporated into To the nginx.conf file "default Nginx Virtual Host profile:/etc/nginx/conf.d/virtual.conf" like Apache Virtual Host configuration, can also be incorporated into the nginx.conf file "default Web_ Root Folder path:/usr/share/nginx/html "Web Directory folder, placing Magento Main program" Configuration Iptables

Iptables -I INPUT 5 -p tcp- -dport -J ACCEPT

Start Nginx

Service Nginx Start

Open IP Address visible "Welcome to nginx!" Indicates that the installation was successful.

============================================================= the following self-added, non-root boot nginx First off the default startup Nginx

Chkconfig --level 2345 nginx off

Copy/etc/nginx/nginx.conf to another place

CP /etc/nginx/nginx. Conf /Home/user/etc/nginx/nginx. conf

Start

/usr/sbin/nginx -C /home/user/etc/nginx/Nginx . conf

Shut down

Killall Nginx

=======================================================conf change to the following

user Nginx; worker_processes 1; error_log /home/user/log/nginx/error. Log warn; PID /Home/user/log/nginx/run/nginx. PID; events { worker_connections 1024x768; }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 /home/user/log/nginx/access. Log main; sendfile on; #tcp_nopush on; keepalive_timeout ; gzip on; include /home/user/etc/nginx/conf. D/*.conf; }

/home/user/etc/nginx/conf.d/default.conf; server {listen 8080; Note: The port is below 1024, be sure to start the root permission to bind (this is a Linux system mechanism problem), otherwise non-r Oot boot will prompt unable to bind port

==========================================

Non-root user-initiated, using port 80:

CD /usr/sbin

Found:-rwxr-xr-x. 1 root root 834352 Dec 00:57 nginx add s to Nginx according to the online saying:

chmod u+s nginx

See more:-rwsr-xr-x.        1 root root 834352 Dec 00:57 nginx Start again with non-root: Root 1736 1 0 23:51?        00:00:00 nginx:master process/usr/sbin/nginx-c/home/user/etc/nginx/nginx.confnginx 1737 1736 0 23:51? 00:00:00 Nginx:worker Process main thread or root. The child thread is not necessarily root.

Other than that:

If the Nginx settings directory is below/home/user. /home/user must give o+x permission, otherwise will be reported 403 Forbidden Original: Http://leyewen.blog.163.com/blog/static/25060614201243105412500/

centos6.x Installation Configuration Nginx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.