Last update at :2024-06-17,Edit by888u
In the previous article \\"Pseudo-static solution for WordPress program in LNMP environment\\" we have learned how to set up WordPress pseudo-static in Nginx environment, because Nginx is not as simple as Apache directly throwing a .HTACCESS. Manual settings are required. Among our commonly used CMS programs, Joomla is also a very good content management system, and its security is much better than the DEDECMS we are familiar with. And using pseudo-static paths can save our space resources.
The first step is to prepare a pseudo-static script.
server { listen 80; server_name laozuo.org; server_name_in_redirect off; access_log /var/log/nginx/localhost.access_log main; error_log /var/log/nginx/localhost.error_log info; root PATH_ON_SERVER; index index.php index.html index .htm default.html default.htm; # Support Clean (aka Search Engine Friendly) URLs location / { try_files $uri $uri/ /index.php$args; } # deny running scripts inside writable directories location ~* /(images| cache|media|logs|tmp)/.*\\\\.(php|pl|py|jsp|asp|sh|cgi)$ { return 403; error_page 403 /403_error.html; } location ~ \\\\ .php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include /etc/nginx/fastcgi.conf; } # caching of files location ~* \\\\.( ico|pdf|flv)$ { expires 1y; } location ~* \\\\.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ { expires 14d; }}The domain name above needs to be written as our own.
The second step is to modify the file.
/usr/local/nginx/conf/vhost/www.laozuo.org.conf
This file is automatically generated when we add a domain name site, and then modify this script to the pseudo-static file in the first step, and replace everything and it will be OK. In this way, we write all the pseudo-static, instead of using the calling method like wordpress. The effect is the same.
Finally, after the modification is completed, we need to restart LNMP.
/root/lnmp restart
Recommended site searches: Ministry of Industry and Information Technology website registration inquiry, US virtual host, monthly payment space, overseas server rental price, Hong Kong server rental 99idc, Hong Kong vps host, cm domain name registration, Foshan high defense server, vps server rental, domain name query ,
发表评论