{"id":6380,"date":"2016-10-13T06:44:12","date_gmt":"2016-10-12T22:44:12","guid":{"rendered":"http:\/\/rmohan.com\/?p=6380"},"modified":"2016-10-13T08:42:23","modified_gmt":"2016-10-13T00:42:23","slug":"under-linux-server-security-configuration-of-nginx","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6380","title":{"rendered":"Linux server security configuration of Nginx"},"content":{"rendered":"<p><strong>Under Linux server security configuration of Nginx<\/strong><\/p>\n<p>1, some common sense<br \/>\nunder Linux, you want to read a file, you first need to have execute permissions for the folder where the file, and then you need to read permissions on the file.<\/p>\n<p>Execute permissions php files do not need the file, you only need read permission nginx and php-fpm run accounts.<\/p>\n<p>After uploading Trojans, you can not list the contents of a folder with php-fpm running account permission to read the relevant folder permissions Trojans execute commands with the account permissions php-fpm related.<\/p>\n<p>If the Trojan to execute the command, you need php-fpm account the corresponding sh Executive authority.<\/p>\n<p>Reads a file within the folder, the folder is not necessary to have read access, only for folders have execute permissions.<\/p>\n<p>1, the top of the configuration<br \/>\n1, the top of the configuration<\/p>\n<p>#define Nginx users and user groups to run<br \/>\nuser nginx;<\/p>\n<p># processes Files<br \/>\npid \/var\/run\/nginx.pid;<\/p>\n<p>#Error log locations and levels, Debug, the info, Notice, The warn, error, criteres<br \/>\nerror_log \/var\/log\/nginx\/error.log warn;<\/p>\n<p>#Nginx number of worker processes, and can be set for the number of CPU cores available.<br \/>\nworker_processes 8;<\/p>\n<p># each worker limit the maximum number of open file descriptors. The theoretical value should be opened up to the number (the value of the system ulimit -n) divided by the number of processes and nginx file, but nginx allocation request is not uniform, it is proposed that is consistent with the value of ulimit -n.<br \/>\nworker_rlimit_nofile 65535;<\/p>\n<p>2, Events module<\/p>\n<p>events {<br \/>\n# worker processes simultaneously set a maximum number of connections open<br \/>\nworker_connections 2048;<\/p>\n<p># tell nginx connection after receiving a new notification to accept as many connections<br \/>\nmulti_accept on;<\/p>\n<p>#set for multiplexing client thread polling method. If you use Linux 2.6+, you should use epoll. If you use * BSD, you should use kqueue.<br \/>\nuse epoll;<br \/>\n}<\/p>\n<p>3?HTTP<br \/>\nhttp {<br \/>\n#hide Nginx version number, to improve security.<br \/>\nserver_tokens off;<\/p>\n<p># Open and efficient file transfer mode, sendfile sendfile directive specifies Nginx whether to call a function to output files for common applications is set on, if used to download applications such as disk IO heavy duty applications, can be set off, in order to balance the disk and network I \/ O processing speed and reduce the load on the system.<br \/>\nsendfile on;<\/p>\n<p># whether open access directory listing, turned off by default.<br \/>\nautoindex off;<\/p>\n<p>#?? Nginx<br \/>\ntcp_nopush on;<\/p>\n<p># tell Nginx to send a data package in all the header files, not one by one to send<\/p>\n<p># Nginx told not to cache data, but transmits a section &#8211; when the need for timely sending data, it should be when setting this property to the application, which sends a small piece of data can not be obtained immediately return a value. Nginx default tcp nopush always work in the state. However, when the open front sendfile on; when its work is characterized by a final package nopush will automatically switch to turn nopush off. To reduce that delay of 200ms, open nodelay on;<br \/>\nit is quickly transmitted. The conclusion is that sendfile on; when open, tcp_nopush and tcp_nodelay are on is possible.<br \/>\ntcp_nodelay on;<\/p>\n<p># log format set<br \/>\nlog_format main &#8216;$remote_addr &#8211; $remote_user [$time_local] &#8220;$request&#8221; &#8216;<br \/>\n&#8216;$status $body_bytes_sent &#8220;$http_referer&#8221; &#8216;<br \/>\n&#8216;&#8221;$http_user_agent&#8221; &#8220;$http_x_forwarded_for&#8221;&#8216;;<br \/>\n# define access log set to off to turn off logging, improve performance<br \/>\naccess_log \/var\/log\/nginx\/access.log main;<\/p>\n<p>#Connection timeout, in seconds<br \/>\nkeepalive_timeout 120;<\/p>\n<p># read the HTTP header timeout, the default value of 60. Client and server to establish a connection start after receiving HTTP header, in the process, if not read in a time interval (timeout) to the client sent byte is considered overtime, returned to the client 408 ( &#8220;Request timed out&#8221;) response.<br \/>\nclient_header_timeout 60;<\/p>\n<p># the default value of 60. Similar client_header_timeout, but this time-out only when valid HTTP packet body read.<br \/>\nclient_body_timeout 10;<\/p>\n<p># send a response, the default value of 60. That Nginx server to the client to send data packets, but the client does not have to receive the packet. If a connection over send_timeout defined timeout period, then Nginx will close the connection.<br \/>\nsend_timeout 60;<\/p>\n<p># by sending RST packets to the client after a direct connection timeout to reset the connection. When this option is turned on, Nginx will timeout after a connection, instead of using the normal case under the four-way handshake to close a TCP connection, but sends RST reset packets directly to users without waiting for user&#8217;s response, released directly on Nginx server All about the cache (such as TCP sliding window) socket used. Compared to the normal shutdown mode, which allows the server to avoid many in FIN_WAIT_1, FIN_WAIT_2, TCP TIME_WAIT state connection.<br \/>\nNote that the use RST reset packets to close the connection will bring some problems, by default will not open.<br \/>\nreset_timedout_connection off;<\/p>\n<p># To restrict access, you must have a connection to the container counts, &#8220;zone =&#8221; is to give it a name, you can easily call, agreed to keep the name below limit_conn. $ binary_remote_addr binary to store the client&#8217;s address, 1m can store 32,000 concurrent sessions.<br \/>\nlimit_conn_zone $binary_remote_addr zone=addr:5m;<\/p>\n<p># given the key to set the maximum number of connections. Here is the key addr, we set value is 100, which means that we allow each IP address to open up to 100 simultaneous connections.<br \/>\nlimit_conn addr 100;<\/p>\n<p># 100k limit for each connection. That if one IP allows two concurrent connections, then the IP is the speed limit 200K.<br \/>\nlimit_rate 100k;<\/p>\n<p>#include directive is another file that contains the contents of the current file. Here we use it to load the file extension and the file type mapping table. nginx according to the mapping relationship set http request response Content-Type header value. When not found in the mapping table, the default value nginx.conf in default-type specified.<br \/>\ninclude \/etc\/nginx\/mime.types;<\/p>\n<p>#default MIME-type # settings files used<br \/>\ndefault_type text\/html;<\/p>\n<p># default encoding<br \/>\ncharset UTF-8;<\/p>\n<p># This module can read the pre-compressed gz file, thus reducing each request gzip compression CPU resource consumption. After the module is enabled, nginx first checks whether the file exists gz ending requests for static files, if there is a direct return to the gz file contents.<br \/>\ngzip_static off;<\/p>\n<p># Turn gzip compression.<br \/>\ngzip on;<\/p>\n<p># disable client is IE6 when gzip functions.<br \/>\ngzip_disable &#8220;msie6&#8221;;<\/p>\n<p>##Nginx as a reverse proxy when enabled. Available Values: OFF | expired The | NO-Cache | NO-Sotre | Private | no_last_modified | no_etag | the auth | the any<br \/>\ngzip_proxied any;<\/p>\n<p># set the minimum number of pages that allow compressed bytes, the number of bytes from the header page header Content- Length of the acquired. Recommendations set larger than the number of bytes 1k, 1k may be less than the greater the pressure.<br \/>\ngzip_min_length 1024;<\/p>\n<p># Set the data compression level. This level can be any number between 1-9, 9 is the slowest but maximum compression ratio<br \/>\ngzip_comp_level 5;<\/p>\n<p># Set the system to obtain several cache unit for storing gzip compression result data stream. 4 4k 4k representative example as a unit, according to the original data size in units of 4 times 4k application memory. If not set, the default is the same size as the original application with data memory space to store gzip compressed results.<br \/>\ngzip_buffers 4 16k;<\/p>\n<p># Set the desired compressed data format. Nginx default only text \/ html compression.<br \/>\ngzip_types text\/plain text\/css application\/json application\/x-javascript text\/xml application\/xml application\/xml+rss text\/javascript;<\/p>\n<p># designated as open file cache, the default is not enabled, max specify the cache number of recommendations and open the file number is consistent, inactive refers to how long the file has not been deleted cached request.<br \/>\nopen_file_cache max=65535 inactive=30s;<\/p>\n<p># valid information check how long the cache<br \/>\nopen_file_cache_valid 30s;<\/p>\n<p># within #open_file_cache instruction inactive time parameter file using the least number of times, if this number is exceeded, the file descriptor has been opened in the cache of. Last-Modified the same situation, because when nginx after a static file cache, if it is still access the 30s, so it&#8217;s cache has existed until the 30s you do not visit so far.<br \/>\nopen_file_cache_min_uses 2;<\/p>\n<p># whether the records cache error<br \/>\nopen_file_cache_errors on;<\/p>\n<p>include \/etc\/nginx\/conf.d\/*.conf;<br \/>\ninclude \/etc\/nginx\/sites-enabled\/*;<br \/>\n}<\/p>\n<p>4, SERVER module<\/p>\n<p>server {<br \/>\n# listening port, nginx based HOST request to determine which configuration section to use SERVER. If no matching server_name, use the default configuration file first. Plus default_server you can not specify the default rule to match.<br \/>\n#listen 80;<br \/>\nlisten 80 default_server;<\/p>\n<p># can have multiple domain names, separated by spaces<br \/>\nserver_name www.test.com test.com;<br \/>\nroot \/user\/share\/nginx\/html\/test;<\/p>\n<p># 404 page configuration<br \/>\nerror_page 404 \/404.html;<\/p>\n<p># configuration ssl, when there is need to open.<br \/>\nssl on;<br \/>\nssl_certificate \/etc\/nginx\/ssl\/server.crt;<br \/>\nssl_certificate_key \/etc\/nginx\/ssl\/server.key;<\/p>\n<p>location \/ {<br \/>\nindex index.html index.php;<br \/>\n}<\/p>\n<p># picture cache time<br \/>\nlocation ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ {<br \/>\nexpires 10d;<br \/>\n}<\/p>\n<p>#js and CSS cache time<br \/>\nlocation ~ .*.(js|css)?$ {<br \/>\nexpires 1h;<br \/>\n}<\/p>\n<p>location ~ [^\/]\\.php(\/|$) {<br \/>\nfastcgi_index index.php;<br \/>\n# open PATH_INFO support role is in accordance with the parameters given regular expression is divided into a $ fastcgi_script_name and $ fastcgi_path_info.<br \/>\n# For example: When requested index.php \/ id \/ 1 without this line configuration, fastcgi_script_name is \/index.php\/id\/1,fastcgi_path_info is empty.<br \/>\n# Plus, fastcgi_script_name is index.php, fastcgi_path_info is \/ the above mentioned id \/ 1<br \/>\nfastcgi_split_path_info ^(.+\\.php)(.*)$;<\/p>\n<p># This value is the PHP in $ _SERVER [ &#8216;SCRIPT_FILENAME&#8217;] value<br \/>\nfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br \/>\nfastcgi_param PATH_INFO $fastcgi_path_info;<br \/>\nfastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;<\/p>\n<p># specify the FastCGI server listening port and address. PHP-FPM and shall be the same settings.<br \/>\n127.0.0.1:9000;#fastcgi_pass;<br \/>\nfastcgi_pass unix:\/var\/run\/php5-fpm.sock;<br \/>\ninclude fastcgi_params;<br \/>\n}<br \/>\n}<\/p>\n<p>2, prohibit access to IP<\/p>\n<p>2, the common mode<br \/>\n1. Let Trojans after uploading can not be performed: Upload directory for added configured in nginx configuration file, so this directory is unable to resolve PHP<br \/>\n2. Let Trojans do not see the non-execution site directory files: Cancel php-fpm running account read permissions for other directories<br \/>\n3. run can not be performed after the Trojan: cancel php-fpm execute permissions for the account of sh<br \/>\n4. after command execution permission is not too high: php-fpm account with root or not root join group<\/p>\n<p>3, the specific configuration of<br \/>\n1 to deny access to files and execute php<\/p>\n<p>3, the specific configuration of<br \/>\n1 to deny access to files and execute php<br \/>\nlocation ~ \/(attachments|upload)\/.*\\.(php|php5)?$ {<br \/>\ndeny all;<br \/>\n}<\/p>\n<p>2, prohibit access to IP<\/p>\n<p>\/\/ Disable the wording of<br \/>\nthe deny 10.0.0.0\/24;<\/p>\n<p>\/\/ wording allowed<br \/>\nthe allow 10.0.0.0\/24;<br \/>\nthe deny All;<\/p>\n<p>3, according to the user&#8217;s real IP connection limits do<\/p>\n<p>## Here for the original user&#8217;s IP address<br \/>\nmap $http_x_forwarded_for $clientRealIp {<br \/>\n&#8220;&#8221; $remote_addr;<br \/>\n~^(?P&lt;firstAddr&gt;[0-9\\.]+),?.*$ $firstAddr;<br \/>\n}<\/p>\n<p>## For the original user IP address restrictions do<br \/>\nlimit_conn_zone $clientRealIp zone=TotalConnLimitZone:20m ;<br \/>\nlimit_conn TotalConnLimitZone 50;<br \/>\nlimit_conn_log_level notice;<\/p>\n<p>## for the original user&#8217;s IP address restrictions do<br \/>\nlimit_req_zone $clientRealIp zone=ConnLimitZone:20m rate=10r\/s;<br \/>\n#limit_req zone=ConnLimitZone burst=10 nodelay;<br \/>\nlimit_req_log_level notice;<\/p>\n<p>## specific server configuration<br \/>\nserver {<br \/>\nthe listen 80;<br \/>\nLOCATION ~ \\ .php $ {<br \/>\n## queuing up to 5, since the processing 10 requests per second + 5 line, one second you send up to 15 request over more direct return 503 error to you<br \/>\nlimit_req Zone = ConnLimitZone Burst = 5 NoDelay \u2122;<\/p>\n<p>fastcgi_pass 127.0.0.1:9000;<br \/>\nfastcgi_index the index.php;<br \/>\nthe include fastcgi_params;<br \/>\n}<\/p>\n<p>}<\/p>\n<p>4, after a multi-CDN obtain the original user&#8217;s IP address, nginx configuration<\/p>\n<p>$ HTTP_X_FORWARDED_FOR $ clientRealIp {Map<br \/>\n## not through a proxy, the direct use of REMOTE_ADDR<br \/>\n&#8220;&#8221; $ REMOTE_ADDR;<br \/>\n## with a regular match, made from the user&#8217;s original x_forwarded_for the IP<br \/>\n##, for example X-Forwarded-For: 202.123.123.11, 208.22.22.234 , 192.168.2.100, &#8230;<br \/>\n## where the first 202.123.123.11 is the user&#8217;s real IP, behind other is through the CDN server<br \/>\n~ ^ (? P &lt;firstAddr&gt; [0-9 \\.] +) ,? . * $ $ firstAddr;<br \/>\n}<\/p>\n<p>## through the map command, we created a variable nginx $ clientRealIp, this is the real IP address of the original user,<br \/>\n## whether the user is a direct access, or access through a bunch of CDN after we You can obtain the correct IP address of the original<\/p>\n<p>5?hide version<\/p>\n<p>server_tokens off;<br \/>\nproxy_hide_header X-Powered-By;<br \/>\n\/\/ compile time or modify the source code<\/p>\n<p>6?disable non-essential method<\/p>\n<p>if ($request_method !~ ^(GET|HEAD|POST)$ ) {<br \/>\nreturn 444;<br \/>\n}<\/p>\n<p>7 Disable extension<\/p>\n<p>location ~* .(txt|doc|sql|gz|svn|git)$ {<br \/>\ndeny all;<br \/>\n}<\/p>\n<p>8, the rational allocation response header<br \/>\nadd_header Strict-Transport-Security &#8220;max-age=31536000&#8221;;<br \/>\nadd_header X-Frame-Options deny;<br \/>\nadd_header X-Content-Type-Options nosniff;<br \/>\nadd_header Content-Security-Policy &#8220;default-src &#8216;self&#8217;; script-src &#8216;self&#8217; &#8216;unsafe-inline&#8217; &#8216;unsafe-eval&#8217; https:\/\/a.disquscdn.com; img-src &#8216;self&#8217; data: https:\/\/www.google-analytics.com; style-src &#8216;self&#8217; &#8216;unsafe-inline&#8217;; frame-src https:\/\/disqus.com&#8221;;<\/p>\n<p>Strict-Transport-Security (abbreviated as HSTS) you can tell the browser within the specified max-age, always through HTTPS access<\/p>\n<p>X-Frame-Options page to specify whether to allow this to be nested iframe, deny that allowed any nested occur<\/p>\n<p>9, refused several User-Agents<\/p>\n<p>if ($http_user_agent ~* LWP::Simple|BBBike|wget) {<br \/>\nreturn 403;<br \/>\n}<\/p>\n<p>10, to prevent image hotlinking<\/p>\n<p>valid_referers blocked www.example.com example.com;<br \/>\nif ($invalid_referer) {<br \/>\nrewrite ^\/images\/uploads.*\\.(gif|jpg|jpeg|png)$ http:\/\/www.examples.com\/banned.jpg last<br \/>\n}<\/p>\n<p>11, a control buffer overflow attacks<\/p>\n<p>client_body_buffer_size 1K;<br \/>\nclient_header_buffer_size 1k;<br \/>\nclient_max_body_size 1k;<br \/>\nlarge_client_header_buffers 2 1k;<\/p>\n<p>explain<\/p>\n<p>1, client_body_buffer_size 1k- (default 8k or 16k) This instruction can specify a connection request buffer size entities. If the value exceeds the specified buffer connection request, then the whole or part of the requesting entity will attempt to write to a temporary file.<br \/>\n2, client_header_buffer_size 1k- directive specifies the client request buffer size of the head. In most cases a request header is not greater than 1k, but if there is a large cookie wap from clients it may be greater than 1k, Nginx will be assigned to it a larger buffer, this value can be set inside the large_client_header_buffers .<br \/>\n3, client_max_body_size 1k- directive specifies the maximum allowable size of the client requesting entity connected, it appears in the Content-Length header field of the request. If the request is greater than the specified value, the client will receive a &#8220;Request Entity Too Large&#8221; (413 ) error. Remember, the browser does not know how to show this error.<br \/>\n4, large_client_header_buffers- specify the client number and size of some of the larger buffer request header use. Request a field can not be greater than the buffer size, if the client sends a relatively large head, nginx returns &#8220;Request URI too large&#8221; (414 )<br \/>\nclient_body_timeout 10;<br \/>\nclient_header_timeout 10;<br \/>\nkeepalive_timeout 5 5;<br \/>\nsend_timeout 10;<\/p>\n<p>1, client_body_timeout 10; &#8211; read instruction specified timeout request entity. Here timeout refers to a requesting entity did not enter the reading step, if the connection after this time the client does not have any response, Nginx will return a &#8220;Request time out&#8221; (408) error.<br \/>\n2, client_header_timeout 10; &#8211; directive specifies the client request header headline read timeout. Here timeout refers to a request header did not enter the reading step, if the connection after this time the client does not have any response, Nginx will return a &#8220;Request time out&#8221; (408) error.<br \/>\n3, keepalive_timeout 5 5; &#8211; the first parameter specifies the timeout length of the client and server connections, over this time, the server closes the connection. The second value of the parameter (optional) specifies the response header Keep-Alive: timeout = time value of the time, this value can make some browsers know when to close the connection to the server without having to repeatedly shut down, if you do not specify this parameter , nginx does not send Keep-Alive header information in the response. (This does not refer to how to connect a &#8220;Keep-Alive&#8221;) values of these two parameters can be different.<br \/>\n4, send_timeout 10; directive specifies the timeout is sent to the client after the response, Timeout refers not enter the state established a complete, finished only two handshakes, if more than this time the client send nothing, nginx will close the connection.<br \/>\n12, a control concurrent connections<\/p>\n<p>limit_zone slimits $binary_remote_addr 5m;<br \/>\nlimit_conn slimits 5;<\/p>\n<p>13?sysctl.conf<\/p>\n<p># Avoid a smurf attack<br \/>\nnet.ipv4.icmp_echo_ignore_broadcasts = 1<\/p>\n<p># Turn on protection for bad icmp error messages<br \/>\nnet.ipv4.icmp_ignore_bogus_error_responses = 1<\/p>\n<p># Turn on syncookies for SYN flood attack protection<br \/>\nnet.ipv4.tcp_syncookies = 1<\/p>\n<p># Turn on and log spoofed, source routed, and redirect packets<br \/>\nnet.ipv4.conf.all.log_martians = 1<br \/>\nnet.ipv4.conf.default.log_martians = 1<\/p>\n<p># No source routed packets here<br \/>\nnet.ipv4.conf.all.accept_source_route = 0<br \/>\nnet.ipv4.conf.default.accept_source_route = 0<\/p>\n<p># Turn on reverse path filtering<br \/>\nnet.ipv4.conf.all.rp_filter = 1<br \/>\nnet.ipv4.conf.default.rp_filter = 1<\/p>\n<p># Make sure no one can alter the routing tables<br \/>\nnet.ipv4.conf.all.accept_redirects = 0<br \/>\nnet.ipv4.conf.default.accept_redirects = 0<br \/>\nnet.ipv4.conf.all.secure_redirects = 0<br \/>\nnet.ipv4.conf.default.secure_redirects = 0<\/p>\n<p># Don&#8217;t act as a router<br \/>\nnet.ipv4.ip_forward = 0<br \/>\nnet.ipv4.conf.all.send_redirects = 0<br \/>\nnet.ipv4.conf.default.send_redirects = 0<\/p>\n<p># Turn on execshild<br \/>\nkernel.exec-shield = 1<br \/>\nkernel.randomize_va_space = 1<\/p>\n<p># Tuen IPv6<br \/>\nnet.ipv6.conf.default.router_solicitations = 0<br \/>\nnet.ipv6.conf.default.accept_ra_rtr_pref = 0<br \/>\nnet.ipv6.conf.default.accept_ra_pinfo = 0<br \/>\nnet.ipv6.conf.default.accept_ra_defrtr = 0<br \/>\nnet.ipv6.conf.default.autoconf = 0<br \/>\nnet.ipv6.conf.default.dad_transmits = 0<br \/>\nnet.ipv6.conf.default.max_addresses = 1<\/p>\n<p># Optimization for port usefor LBs<br \/>\n# Increase system file descriptor limit<br \/>\nfs.file-max = 65535<\/p>\n<p># Allow for more PIDs (to reduce rollover problems); may break some programs 32768<br \/>\nkernel.pid_max = 65536<\/p>\n<p># Increase system IP port limits<br \/>\nnet.ipv4.ip_local_port_range = 2000 65000<\/p>\n<p># Increase TCP max buffer size setable using setsockopt()<br \/>\nnet.ipv4.tcp_rmem = 4096 87380 8388608<br \/>\nnet.ipv4.tcp_wmem = 4096 87380 8388608<\/p>\n<p># Increase Linux auto tuning TCP buffer limits<br \/>\n# min, default, and max number of bytes to use<br \/>\n# set max to at least 4MB, or higher if you use very high BDP paths<br \/>\n# Tcp Windows etc<br \/>\nnet.core.rmem_max = 8388608<br \/>\nnet.core.wmem_max = 8388608<br \/>\nnet.core.netdev_max_backlog = 5000<br \/>\nnet.ipv4.tcp_window_scaling = 1<\/p>\n<p>14 Firewall Rules<br \/>\n\/sbin\/iptables -A INPUT -p tcp &#8211;dport 80 -i eth0 -m state &#8211;state NEW -m recent &#8211;set<br \/>\n\/sbin\/iptables -A INPUT -p tcp &#8211;dport 80 -i eth0 -m state &#8211;state NEW -m recent &#8211;update &#8211;seconds 60 &#8211;hitcount 15 -j DROP<\/p>\n<p>15?Nginx<\/p>\n<p>\/sbin\/iptables -A OUTPUT -o eth0 -m owner &#8211;uid-owner vivek -p tcp &#8211;dport 80 -m state &#8211;state NEW,ESTABLISHED -j ACCEPT<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>www.rmohan.com<br \/>\nwww.rmohan.net<\/p>\n<p>nginx<\/p>\n<p>nginx.conf<\/p>\n<p>www.rmohan.com\u00a0 http:\/\/192.168.1.18:8080<br \/>\nwww.rmohan.net\u00a0 http:\/\/192.168.1.18:8181<\/p>\n<p>server1?<\/p>\n<p>server {<br \/>\nlisten\u00a0\u00a0\u00a0\u00a0\u00a0 80;<br \/>\nserver_name\u00a0 www.rmohan.com;<\/p>\n<p>location \/ {<\/p>\n<p>proxy_set_header\u00a0 Host rmohan.com;<br \/>\nproxy_redirect off;<br \/>\nproxy_set_header\u00a0 X-Real-IP $remote_addr;<br \/>\nproxy_set_header X-Forwarded-For $remote_addr;<br \/>\nproxy_pass http:\/\/192.168.95.180:8080;<\/p>\n<p>}<br \/>\n}<\/p>\n<p>server2?<\/p>\n<p>server {<br \/>\nlisten\u00a0\u00a0\u00a0\u00a0\u00a0 80;<br \/>\nserver_name\u00a0 www.rmohan.net;<\/p>\n<p>location \/ {<\/p>\n<p>proxy_set_header\u00a0 Host rmohan.net;<br \/>\nproxy_redirect off;<br \/>\nproxy_set_header\u00a0 X-Real-IP $remote_addr;<br \/>\nproxy_set_header X-Forwarded-For $remote_addr;<br \/>\nproxy_pass http:\/\/192.168.95.181:8181;<\/p>\n<p>}<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Under Linux server security configuration of Nginx<\/p>\n<p>1, some common sense under Linux, you want to read a file, you first need to have execute permissions for the folder where the file, and then you need to read permissions on the file.<\/p>\n<p>Execute permissions php files do not need the file, you only need read [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[70],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6380"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6380"}],"version-history":[{"count":3,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6380\/revisions"}],"predecessor-version":[{"id":6385,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6380\/revisions\/6385"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6380"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6380"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6380"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}