zoukankan      html  css  js  c++  java
  • lnmp建站常识

    1.nginx配置网站目录并修改访问的端口:nginx.conf文件

    listen 666;//端口默认为80,修改后增强安全性
    server_name www.lnmp.org;
    index index.html index.htm index.php;
    root /home/www;

     2.nginx配置虚拟目录:

    (1)修改nginx.conf,加载vhost中的配置项
            include vhost/*.conf; 
    
    (2)如在vhost里写一个配置项:test.conf
    
     server
            {
                    listen       80;
                    server_name test.com;
                    index index.html index.htm index.php default.html default.htm default.php;
                    root  /opt/www/test/www;
    
                    location / {
                            index  index.html index.htm index.php;
    
                            if (!-e $request_filename) {
                                    rewrite ^/(.+)$ /index.php/$1 last;
                            }
                    }
    
                    location ~ .*.(php|php5)?($|/)
                    {
                            fastcgi_pass  unix:/tmp/php-cgi.sock;
                            fastcgi_index index.php;
    
                            fastcgi_param  SCRIPT_FILENAME  /opt/www/test/www/$fastcgi_script_name;
                            fastcgi_split_path_info ^(.+.php)(.*)$;
                            fastcgi_param PATH_INFO $fastcgi_path_info;
    
                            include fcgi.conf;
                    }

    修改完后重启nginx:

    /usr/bin/nginx -s reload

    或/etc/init.d/nginx restart

    Linux 防火墙开放特定端口
    
    iptables是linux下的防火墙,同时也是服务名称。
    
    service  iptables  status         查看防火墙状态
    service  iptables  start          开启防火墙
    service  iptables  stop           关闭防火墙
    service  iptables  restart        重启防火墙

    防火墙开放特定端口:
    
    
    ①文件/etc/sysconfig/iptables    
    
    
    ②添加:
    
    
         -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
    
    
           ★数字8080代表开放8080端口,也可以改成其他的端口
    
    
    ③重启防火墙
     
    时不我待,不负韶华!立刻行动!不吃学习的苦就会吃生活的苦!
  • 相关阅读:
    Go---第七章:接口(小知识点笔记)
    Go---第六章:方法(小知识点笔记)
    Go---第五章:函数(小知识点笔记)
    解决paramiko获取远程脚本延时返回数据的问题
    python字典合并
    关于iperf的使用
    python安装MySQLdb:出错Microsoft Visual C++ 9.0 is required
    v2r
    Win10 HotCorner热角小程序
    去掉显卡桌面右键菜单
  • 原文地址:https://www.cnblogs.com/zrp2013/p/lnmp.html
Copyright © 2011-2022 走看看