Null. Aussage:
Der folgende Inhalt gilt für die Linux-Umgebung und wird mithilfe des Quellcodes installiert
Installationsanleitung für die offizielle Nginx-Website: http://wiki.nginx .org/InstallChs
1. Laden Sie nginx herunter
1. Offizieller Website-Download: http://nginx.org/en/download.html
2. Git-Download: https://github.com/nginx/nginx
2. Notwendige abhängige Bibliotheken
1.pcre
<code>yum -y <span>install</span> pcre* <span>#nginx rewrite模块</span></code>
2.gcc
<code>yum -y <span>install</span> gcc gcc-c++ <span>#编译nginx</span></code>
3. Nginx installieren
1. Den Installationsordner erstellen
<code><span>mkdir</span> -p /web/nginx</code>
3 Nachdem die Kompilierungsparameter
<code>groupadd www useradd <span>-r</span><span>-g</span> www www</code>
erfolgreich konfiguriert wurden, wird der folgende Inhalt ausgegeben
<code><span>.</span>/configure <span>--</span>prefix<span>=</span>/web/nginx <span>--</span><span>with</span><span>-http_stub_status_module</span><span>--</span><span>with</span><span>-pcre</span></code>
4. Kompilieren und installieren Sie
Nachdem die Kompilierung erfolgreich war, geben Sie den folgenden Inhalt aus
<code><span>make</span> && <span>make</span> install</code>
4. Starten Sie nginx
3 5. Überprüfen Sie, ob die Installation erfolgreich ist
<code>/web/nginx/sbin/nginx</code>
6. Herkömmliche Konfiguration
<code><span>#user nobody;</span><span>worker_processes</span><span>1</span>; <span>#error_log logs/error.log;</span><span>#error_log logs/error.log notice;</span><span>error_log</span> logs/error.log <span>info</span>; <span>pid</span> logs/nginx.pid; <span>events</span> { <span>worker_connections</span><span>1024</span>; } <span>http</span> { <span>include</span> mime.types; <span>default_type</span> application/octet-stream; <span>log_format</span> main <span>'<span>$remote_addr</span> - <span>$remote_user</span> [<span>$time_local</span>] "<span>$request</span>" '</span><span>'<span>$status</span><span>$body_bytes_sent</span> "<span>$http_referer</span>" '</span><span>'"<span>$http_user_agent</span>" "<span>$http_x_forwarded_for</span>"'</span>; <span>access_log</span> logs/access.log main; <span>sendfile</span><span>on</span>; <span>#tcp_nopush on;</span><span>#keepalive_timeout 0;</span><span>keepalive_timeout</span><span>65</span>; <span>#gzip on;</span><span>server</span> { <span>listen</span><span>80</span>; <span>server_name</span> localhost; <span>#charset koi8-r;</span><span>#access_log logs/host.access.log main;</span><span>location</span> / { <span>root</span> html; <span>index</span> index.html index.htm; } <span>#error_page 404 /404.html;</span><span># redirect server error pages to the static page /50x.html</span><span>#</span><span>error_page</span><span>500</span><span>502</span><span>503</span><span>504</span> /50x.html; <span>location</span> = /50x.html { <span>root</span> html; } <span># proxy the PHP scripts to Apache listening on 127.0.0.1:80</span><span>#</span><span>#location ~ \.php$ {</span><span># proxy_pass http://127.0.0.1;</span><span>#}</span><span># pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000</span><span>#</span><span>#location ~ \.php$ {</span><span># root html;</span><span># fastcgi_pass 127.0.0.1:9000;</span><span># fastcgi_index index.php;</span><span># fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;</span><span># include fastcgi_params;</span><span>location</span><span>~ \.php$</span> { <span>root</span> /web/www/zhengrui/html/admin; <span>fastcgi_pass</span><span>127.0.0.1:9000</span>; <span>fastcgi_index</span> index.php; <span>include</span> fastcgi_params; <span>fastcgi_param</span> SCRIPT_FILENAME <span>$document_root</span><span>$fastcgi_script_name</span>; <span>fastcgi_param</span> SCRIPT_NAME <span>$fastcgi_script_name</span>; } <span># deny access to .htaccess files, if Apache's document root</span><span># concurs with nginx's one</span><span>#</span><span>#location ~ /\.ht {</span><span># deny all;</span><span>#}</span> } <span># another virtual host using mix of IP-, name-, and port-based configuration</span><span>#</span><span>#server {</span><span># listen 8000;</span><span># listen somename:8080;</span><span># server_name somename alias another.alias;</span><span># location / {</span><span># root html;</span><span># index index.html index.htm;</span><span># }</span><span>#}</span><span># HTTPS server</span><span>#</span><span>#server {</span><span># listen 443 ssl;</span><span># server_name localhost;</span><span># ssl_certificate cert.pem;</span><span># ssl_certificate_key cert.key;</span><span># ssl_session_cache shared:SSL:1m;</span><span># ssl_session_timeout 5m;</span><span># ssl_ciphers HIGH:!aNULL:!MD5;</span><span># ssl_prefer_server_ciphers on;</span><span># location / {</span><span># root html;</span><span># index index.html index.htm;</span><span># }</span><span>#}</span>}</code>